jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Testing speed of a standard for loop vs. Array.indexOf.
<script>
var ar = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var arHuge = [18367, 18405, 19537, 19960, 20655, 20795, 20833, 20896, 20946, 20968, 21052, 21284, 21534, 22236, 22252, 23516, 23776, 24299, 24443, 37742, 38292, 39264, 39779, 40464, 41930, 42004, 42046, 42745, 43235, 43915, 63433, 65298, 68286, 68550, 70788, 71643, 71863, 72265, 72568, 73739, 74626, 74881, 75023, 75360, 75492, 75728, 95512, 95543, 95588, 97155, 97765, 97888, 98000, 99052, 99285, 99483, 99558, 99774, 100151, 100811, 101071, 101504, 102340, 104167, 104208, 105383, 160489, 161095, 163452, 165400, 165615, 165660, 166360, 166618, 167887, 168430, 168513, 168958, 169125, 169601, 170030, 170169, 170720, 170958, 172248, 192563, 192631, 192729, 193544, 193669, 194041, 194124, 194286, 195543, 195585, 195923, 196115, 197211, 199490, 200332, 202132, 304927, 304933, 304934, 304953, 304978, 304982, 305004, 305021, 305024, 305029, 305046, 305047, 305048, 305057, 305065, 305084, 305094, 305108, 305111, 305117, 305119, 305140, 305146, 305150, 305151, 305153, 305190, 305197, 305208, 305225, 305237, 305258, 305264, 305271, 305272, 305283, 305293, 305297, 305301, 305312, 305317, 305328, 305346, 305360, 305397, 305402, 305414, 305418, 305420, 305446, 305447, 305452, 305454, 305467, 305501, 305502, 305516, 305529, 305537, 305556, 305562, 305570, 305575, 305579, 305633, 305636, 305648, 305726, 305738, 305741, 305742, 305756, 305773, 305778, 305783, 305824, 305832, 305843, 305897, 305942, 305957, 305962, 305971, 306001, 306010, 306014, 306031, 306036, 306125, 306139, 306150, 306199, 306203, 306205, 306217, 306219, 306220, 306228, 306308, 306331, 306344, 306409, 306468, 306522, 306533, 306559, 306586, 306650, 306701, 306708, 306711, 306721, 306768, 306775, 306793, 306820, 306827, 306834, 306837, 306844, 306874, 306896, 306905, 306911, 306924, 306969, 306972, 307016, 307023, 307104, 307117, 307140, 307145, 307164, 307185, 307239, 307352, 307380, 307388, 307408, 307415, 307442, 307456, 307529, 307532, 307581, 307589, 307609, 307649, 307683, 307706, 307717, 307727, 307740, 307775, 307779, 307799, 307807, 307827, 307846, 307856, 307872, 307881, 307884, 307898, 307907, 307916, 307947, 307951, 307968, 308000, 308044, 308051, 308146, 308177, 308181, 308191, 308193, 308194, 308281, 308300, 308353, 308376, 308412, 308454, 308489, 308504, 308554, 308572, 308599, 308617, 308648, 308686, 308696, 308699, 308737, 308749, 308779, 308792, 308794, 308819, 308825, 308831, 308870, 308926, 308933, 308958, 309044, 309049, 309065, 309082, 309118, 309126, 309138, 309184, 309199, 309206, 309207, 309214, 309218, 309220, 309226, 309230, 309231, 309243, 309248, 309318, 309339, 309355, 309414, 309448, 309472, 309523, 309527, 309564, 309589, 309603, 309653, 309683, 309684, 309714, 309729, 309745, 309777, 309779, 309780, 309834, 309851, 309860, 309870, 309882, 309897, 309943, 309956, 309999, 310015, 310025, 310045, 310090, 310092, 310109, 310132, 310135, 310164, 310166, 310168, 310177, 310195, 310208, 310230, 310292, 310294, 310297, 310312, 310320, 310327, 310328, 310344, 310349, 310357, 310386, 310409, 310433, 310452, 310464, 310473, 310482, 310486, 310502, 310512, 310519, 310528, 310540, 310552, 310578, 310581, 310582, 310610, 310618, 310627, 310629, 310636, 310640, 310658, 310661, 310662, 310681, 310694, 310709, 310713, 310729, 310731, 310753, 310758, 310759, 310760, 310767, 310783, 310800, 310808, 310836, 310879, 310887, 310895, 310912, 310913, 310922, 310938, 310939, 310950, 310975, 310976, 310979, 310986, 310988, 310997, 311012, 311023, 311035, 311075, 311081, 311082, 311091, 311098, 311112, 311143, 311165, 311203, 311214, 311221, 311261, 311295, 311297, 311300, 311303, 311305, 311339, 311349, 311370, 311381, 311393, 311401, 311405, 311431, 311441, 311465, 311484, 311489, 311516, 311523, 311530, 311531, 311541, 311545, 311556, 311571, 311573, 311576, 311583, 311598, 311605, 311606, 311621, 311626, 311627, 311639, 311652, 311659, 311668, 311678, 311681, 311685, 311688, 311689, 311706, 311743, 311748, 311761, 311774, 311779, 311783, 311788, 311797, 311802, 311804, 311807, 311808, 311817, 311823, 311841, 311843, 311846, 311873, 311874, 311878, 311901, 311904, 311910, 311912, 311913, 311923, 311928, 311943, 311945, 311952, 311958, 311961, 311965, 311986, 311990, 311991, 312019, 312020, 312023, 312025, 312032, 312043, 312052, 312064, 312068, 312082, 312086, 312089, 312093, 312101, 312103, 312132, 312133, 312145, 312162, 312165, 312172, 312178, 312182, 312183, 312190, 312192, 312204, 312213, 312216, 312238, 312249, 312250, 312279, 312290, 312292, 312301, 312304, 312307, 312308, 312313, 312316, 312322, 312324, 312330, 312332, 312333, 312335, 312336, 312338, 312340, 312360, 312361, 312364, 312365, 312372, 312377, 312382, 312388, 312414, 312423, 312430, 312436, 312449, 312451, 312457, 312477, 312483, 312492, 312504, 312521, 312523, 312524, 312536, 312553, 312555, 312558, 312569, 312576, 312591, 312593, 312596, 312604, 312615, 312627, 312630, 312643, 312653, 312655, 312659, 312667, 312673, 312676, 312680, 312709, 312713, 312724, 312726, 312729, 312739, 312745, 312747, 312755, 312758, 312759, 312760, 312762, 312774, 312781, 312791, 312794, 312797, 312807, 312808, 312812, 312821, 312824, 312825, 312832, 312840, 312850, 312853, 312859, 312869, 312872, 312880, 312882, 312897, 312906, 312908, 312911, 312922, 312929, 312931, 312940, 312943, 312968, 312979, 312982, 312991, 312996, 313002, 313005, 313010, 313017, 313021, 313030, 313038, 313048, 313055, 313061, 313066, 313077, 313078, 313079, 313084, 313095, 313099, 313101, 313102, 313111, 313116, 313117, 313119, 313138, 313145, 313167, 313168, 313179, 313183, 313184, 313186, 313187, 313190, 313199, 313208, 313222, 313227, 313254, 313266, 313270, 313271, 313274, 313277, 313278, 313292, 313311, 313312, 313321, 313322, 313325, 313333, 313346, 313364, 313370, 313379, 313380, 313385, 313390, 313396, 313401, 313413, 313418, 313420, 313431, 313436, 313438, 313442, 313443, 313444, 313450, 313473, 313487, 313488, 313489, 313493, 313503, 313509, 313519, 313520, 313528, 313534, 313544, 313546, 313547, 313548, 313563, 313565, 313570, 313571, 313576, 313578, 313581, 313585, 313589, 313622, 313633, 313642, 313651, 313654, 313667, 313696, 313708, 313715, 313723, 313725, 313728, 313741, 313744, 313750, 313774, 313779, 313780, 313786, 313823, 313866, 313882, 313885, 313888, 313893, 313901, 313918, 313922, 313924, 313927, 313929, 313935, 313942, 313957, 313967, 313969, 313972, 313981, 313994, 314002, 314014, 314019, 314026, 314031, 314034, 314061, 314074, 314075, 314076, 314088, 314116, 314121, 314122, 314130, 314164, 314201, 314207, 314223, 314226, 314235, 314238, 314245, 314256, 314259, 314265, 314276, 314299, 314307, 314310, 314353, 314367, 314378, 314383, 314387, 314396];
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
For loop |
| ready |
other for-loop |
| ready |
indexOf |
| ready |
For loop Huge |
| ready |
indexOf Huge |
| ready |
forIn loop |
| ready |
forIn loop Huge |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.