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
Check performance difference between caching dom elements vs. using a closure to achieve the same result.
<meta name="A" content="1" />
<meta name="B" content="2" />
<meta name="C" content="3" />
<meta name="D" content="4" />
<meta name="E" content="5" />
<script>
var metaTags = document.getElementsByTagName("meta");
function getMetaTags(x) {
var metaTags = document.getElementsByTagName("meta");
getMetaTags = function(y) {
return metaTags[y];
};
return getMetaTags(x);
}
getMetaTags(); // we have to run this to equalize the tests.
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Caching |
| ready |
Closure |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.