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="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js">
</script>
var arr = [];
for (var i = 0; i < 10000; i++) {
arr.push({
Number: i
});
};
var e = null;
function Named(o, i) {
e = o;
};
function Name2(i, o) {
e = o;
};
// asm.js foreach arrays and objects
var forEachAO = function(a, c)
{
"use asm";
if (toString.call(a) === "[object Array]")
{
var l = +a.length;
for (var i = +0; i < l; i++)
c(a[i], i)
}
else
{
var k=Object.keys(a);
var l = +k.length;
for (var i = +0; i < l; i++)
c(a[k[i]], i)
}
}
var forEach = function(a, c) {
var l = a.length;
for (var i = 0; i < l; i++) c(a[i], i)
}
var forEac2 = function(a, c) {
"use asm";
var l = +a.length;
for (var i = +0; i < l; i++) c(a[i], i)
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Jquery each |
| ready |
Underscore each |
| ready |
For normal |
| ready |
For reversed |
| ready |
Native array forEach |
| ready |
Native array forEach with Named function |
| ready |
custom forEach |
| ready |
custom forEach 2 |
| ready |
custom forEach Named |
| ready |
Jquery each Named |
| ready |
Underscore each Named |
| ready |
For normal Named |
| ready |
custom forEach asm.js Named |
| ready |
custom forEach asm.js |
| ready |
Underscore each 2 |
| ready |
forEachAO - foreach for array and objects |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.