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>
Array.prototype.forEachFn = function(value, index, object) {
//return value;
};
Array.prototype.forEachIntern = function() {
var _this = this;
var i; len = _this.length;
for(i=0; i<len; i++) _this.forEachFn(_this[i], i, _this);
};
forEachIntern2 = function(array){
var i; len = array.length;
for(i=0; i<len; i++) callback(array[i], i, array);
};
forEachIntern3 = function(array, fn){
var i; len = array.length;
for(i=0; i<len; i++) fn(array[i], i, array);
};
var array = Array(1000).join('xxxxxxxx').split('');
var callback = function(value, index, object) {
return value;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
for-loop |
| ready |
Array#forEach |
| ready |
for-loop naive |
| ready |
for-loop reversed |
| ready |
for-loop (optimized) |
| ready |
Prototype Internal |
| ready |
| ready | |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.