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
I know that reverse while looping in javascript is faster than for looping, but if order is to be maintained, would rev-while looping then reversing the array be faster or would the traditional for loop out perform this combo?
See http://jsperf.com/js-array-reverse-vs-while-loop/5.
See http://jsperf.com/array-push-reverse-vs-unshift-reverse for array push reverse vs. unshift reverse.
See http://jsperf.com/array-push-vs-unshift/6 for array push vs. unshift reversal.
var array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var length = array.length;
Ready to run.
Test | Ops/sec | |
---|---|---|
for |
| ready |
for reverse |
| ready |
while |
| ready |
while reverse |
| ready |
reverse then reverse |
| ready |
push |
| ready |
unshift |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.