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
Array size = 40; Removed some obscure cases which were not faster on any of the platforms
var arr = [];
var obj = {};
for( var i = 0; i < 40; i++ ) {
arr[ i ] = i+1;
obj[ i ] = i+1;
}
// to let IE7 && other old browsers run this as well
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun)
{
var len = this.length;
for (var i = 0; i < len; ++i)
fun(this[i]);
};
}
Ready to run.
Test | Ops/sec | |
---|---|---|
01) Old ’n’ busted for |
| ready |
02) Old ’n’ busted + length caching |
| ready |
03) Old ’n’ busted + var outside loop |
| ready |
04) Reverse for |
| ready |
05) while loop |
| ready |
06) while loop + length caching |
| ready |
07) Reverse while |
| ready |
08) Reverse do … while loop |
| ready |
09) Cool guy loop + length caching |
| ready |
10) Native forEach |
| ready |
11) Native forEach with named function |
| ready |
12) For In Array |
| ready |
13) For In Object |
| ready |
14) Object Property Accessor using Bracket notation |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.