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 i, fn = this.forEachFn, len = this.length;
for(i=0; i<len; i++) this.forEachFn(this[i], i, this);
};
var array = Array(1000).join('xxxxxxxx').split('');
var callback = function(value, index, object) {
return value;
};
var forEachIntern2 = function(_name, _array){
this.name = _name;
this.array = _array;
this.callback = function(value, index, object) {
return value;
};
this.each = function(){
var i, arr = this.array, len = arr.length;
for(i=0; i<len; i++) this.callback(arr[i], i, arr);
};
};
var forEach = new forEachIntern2('forEachIntern2', array);
</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 |
Internal Class |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.