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
<style>
.one { width: 100px; }
</style>
<div id="candidate">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
function addClass(element, new_class) {
var n = 0;
new_class = new_class.split(",");
for (var i = new_class.length - 1; i >= 0; i--) {
if ((" " + element.className + " ").indexOf(" " + new_class[i] + " ") == -1) {
element.className += " " + new_class[i];
n++;
}
};
return n;
}
</script>
var candidate = document.getElementById('candidate');
$(candidate).removeClass('one')
Ready to run.
Test | Ops/sec | |
---|---|---|
Class (className) |
| ready |
Class (setAttribute) |
| ready |
Style |
| ready |
Style (setAttribute) |
| ready |
| ready | |
classList.add() |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.