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
How much faster is classList.add/remove than className regex manipulation?
<style type="text/css">
.blah{color: black;}
.bleh{font-size: 300px}
.foo{color:#F00;height:50px;opacity:0.3;}
.bar{color:#0F0;height:70px;opacity:0.5;font-size: 900px}
.baz{color:#00F;height:90px;opacity:0.7;font-weight: bold}
</style>
<div id="base" class="">
test 1
</div>
var node = document.getElementById('base');
node.className = 'blah bleh';
var i=0;
Ready to run.
Test | Ops/sec | |
---|---|---|
classList (add) |
| ready |
className raw |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.