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>
<script>
var arraysLength = [1000, 1, 10, 0, 100, 5, 500, 2000];
var arrays = [];
var expectedRet = 0;
arraysLength.forEach(function(length) {
var array = [];
for (var i = 0; i < length; ++i) {
array.push({
n: i
});
expectedRet += i;
};
arrays.push(array);
});
var ret = 0
function oi(o, i) {
ret += o.n;
}
function io(i, o) {
ret += o.n;
}
function check() {
var lastRet = ret;
ret = 0;
if (lastRet != expectedRet)
throw new Error('Wrong ret: ' + lastRet + ', expected: ' + expectedRet);
}
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)
}
</script>
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 |
custom forEach asm.js Named |
| ready |
custom forEach asm.js |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.