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.
<script>
var hasOwn = {}.hasOwnProperty;
var MyObj = (function() {
var i = -1,
result = {},
count = +location.hash.slice(2) || 50;
while (++i < count) result[i] = i;
i = 0;
while (++i < 4) document.getElementById('title-' + i).innerHTML += ' (' + count + ')';
return result;
})();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
With hasOwnProperty |
| ready |
With Generic |
| ready |
Without |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.