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
Compare the performance of several types of for and while loops using the index inside the statement. The idea of comparing those loops is because when decrementing the iteration variable (i--) an adjustment is needed for ascending order output. Other types of loops gotten from http://jsperf.com/for-vs-while/3
<script>
var arr = (new Array(1e3 + 1)).join(1).split(''),
len = arr.length;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
for (i++) |
| ready |
uncached arr length |
| ready |
while asc (aux) |
| ready |
while asc (no aux) |
| ready |
for (++i) |
| ready |
for (advanced) asc (aux) |
| ready |
for (advanced) asc (no aux) |
| ready |
for (advanced) desc |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.