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
This will test all of the major HTML class attribute utility functions.
Please contribute with other solutions!
// test elements
<div id="single-class" class="a"></div>
<div id="multiple-classes" class="a b abcd a-b-c-d"></div>
// libraries to test
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//github.com/dgalarza/RaptorJS/raw/master/src/raptor.pack.js"></script>
<script>
// RaptorJS
var $p = raptor.pack; // to keep prop look-ups equal with competition
var single_class = document.getElementById('single-class');
var multiple_classes = document.getElementById('multiple-classes');
// jQuery
var jQuery_single_class = $('#single-class');
var jQuery_multiple_classes = $('#multiple-classes');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
RaptorJS hasClass |
| ready |
jQuery hasClass |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.