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="http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"></script>
<script>
var someArray = new Array, otherArray = new Array;
for(var i = 0; i < 50; ++i){
someArray.push({id:i, someProp: 'hello', someOtherProp : 'world'});
}
for(var i = 0; i < 10; ++i){
otherArray.push({id:i, someProp: 'hello', someOtherProp : 'world'});
}
var testFor = function(obj){
for(var i = 0; i < someArray.length; ++i){
if(someArray[i] == obj){
someArray.splice(i, 1);
return;
}
}
};
var testIndexOf = function(obj){
var pos = dojo.indexOf(someArray, obj);
if(pos != -1){
someArray.splice(pos, 1);
}
};
var testForSmall = function(obj){
for(var i = 0; i < otherArray.length; ++i){
if(otherArray[i] == obj){
otherArray.splice(i, 1);
return;
}
}
};
var testIndexOfSmall = function(obj){
var pos = dojo.indexOf(otherArray, obj);
if(pos != -1){
otherArray.splice(pos, 1);
}
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
TestForLoop |
| ready |
TestIndexOf |
| ready |
testForSmall |
| ready |
testIndexSmall |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.