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
Test performance hit of calling x.hasOwnProperty()
in a for
-in
loop
This page will run by itself (even though no "#run" is attached to the URL). Since the original design allows it to run with varying count values (by attaching '#cnnnn' to the url where nnnn is an integer), the ability of auto-run allows us to run and collect results of tests automatically.
<script>
var MyObj = (function() {
var i = -1,
result = {},
count = +location.hash.slice(2) || 50;
while (++i < count) result[i] = 'x';
document.getElementById('title-1').innerHTML += ' (' + count + ')';
document.getElementById('title-2').innerHTML += ' (' + count + ')';
document.body.onload= function(){
console.log('body loaded, ready to click [Run tests]');
document.getElementById('run').click();
console.log('clicked and run with count = '+ count)
}
return result;
})();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
With hasOwnProperty |
| ready |
Without |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.