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
Is it faster to cache the length of the iterator when using a traditional for loop, or is accessing the length directly fast enough?
const randomNumbers = [609, 898, 745, 490, 613, 208, 416, 973, 344, 638, 321, 156, 897, 938, 81, 933, 596, 795, 922, 150, 474, 396, 701, 275, 34, 809, 890, 577, 192, 107, 670, 804, 195, 859, 832, 433, 510, 948, 744, 448, 855, 974, 414, 53, 576, 298, 872, 714, 464, 500, 685, 995, 301, 371, 888, 888, 386, 406, 779, 151, 501, 208, 932, 270, 714, 204, 369, 408, 325, 389, 402, 726, 357, 196, 937, 570, 406, 789, 952, 556, 367, 934, 617, 927, 263, 101, 582, 506, 195, 842, 129, 451, 946, 594, 760, 705, 719, 447, 743, 641];
Ready to run.
Test | Ops/sec | |
---|---|---|
No cache |
| ready |
Cache |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.