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
<script src="//code.jquery.com/jquery-git2.min.js"></script>
<script src="//fastjs.net/js/fast.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
var i, values = [],
sum = 0;
for (i = 0; i < 1000; i++) {
values[i] = Math.random() + 1;
}
function add(val) {
sum += val;
}
sum = i = 0;
values = [];
Ready to run.
Test | Ops/sec | |
---|---|---|
ForEach |
| ready |
for loop, simple |
| ready |
for loop, simple (with var) |
| ready |
for loop, cached length |
| ready |
for loop, reverse |
| ready |
for loop, reverse (not equal, with var) |
| ready |
for loop, cached length, no callback |
| ready |
for loop, cached length, no callback (one time „var”, [using var], not equal [len-1] instead of less |
| ready |
for loop, cached length, using function.call and supplying index and original array |
| ready |
While, reversed + simple |
| ready |
While, reversed + simple, leftside --, not linked |
| ready |
While, reversed + callback |
| ready |
While, reversed + callback, -- right side |
| ready |
While |
| ready |
While, one-time var, not equal |
| ready |
simple while |
| ready |
simple while2 |
| ready |
while .pop() |
| ready |
while (++i) |
| ready |
i = i + 1 while |
| ready |
jquery.each |
| ready |
while i++ |
| ready |
for with assignment |
| ready |
while .shift() |
| ready |
while true !.shift() break |
| ready |
angularjs foreach |
| ready |
for var i in values |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.