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
<ul>
<li><a href="#" class="foo">Item</a></li>
<li><a href="#" class="foo" data-bar="true">Item</a></li>
<li><a href="#" class="foo">Item</a></li>
<li><a href="#" class="foo" data-bar="true">Item</a></li>
<li><a href="#" class="foo">Item</a></li>
</ul>
<script>
var list, len, i, result;
var filter = Array.filter || Benchmark.filter;
function notBar(el) {
return !el.hasAttribute('data-bar');
}
var snapshotType = 6; /* XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE */
var fooAndNotBarQuery = "//*[contains(concat(' ', @class, ' '), ' foo ') and not (@data-bar)]";
var expression = document.createExpression(fooAndNotBarQuery, null);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Using getElementsByClassName and filtering |
| ready |
Using document.evaluate |
| ready |
Using XPathExpression.evaluate (reuse expression) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.