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 is a fairly extensive test now but it does have some faults: - this makes an assumption that you're caching your jQuery/Zepto objects, if you're simply using the selector engine you'll get an 80% slowdown - these numbers aren't including optimizations that V8/etc. can make to functions since these are created each test
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
<script src="http://zeptojs.com/zepto.min.js"></script>
<div id="testDiv" class="class3">
<style>
.class1{ color: red }
</style>
z = Zepto;
cachedZ = z('#testDiv');
cached$ = $('#testDiv');
cachedEl = cached$[0];
// addClass (classList detection with jQuery fallback)
var supportClassList = typeof document.documentElement.classList !== 'undefined';
function addClassF(el,cls) {
var clss, classList, i, l;
if (typeof cls === 'string') {
clss = cls.split(/\s+/);
} else if (cls instanceof Array) {
clss = cls;
}
classList = el.classList
for (i = 0, l = clss.length; i < l; i++) {
classList.add(clss[i]);
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
jquery addClass |
| ready |
DOM classList |
| ready |
DOM classList with check |
| ready |
DOM classList with className check |
| ready |
DOM classList multiple |
| ready |
Zepto addClass |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.