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
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js">
</script>
<script src="http://zeptojs.com/zepto.min.js"></script>
<div id="testDiv"></div>
<style>
.class1{ color: red; }
</style>
z = Zepto;
// addClass (classList detection with jQuery fallback)
var supportClassList = typeof document.documentElement.classList !== 'undefined';
function addClassF(el,cls)
{
var clss;
if (typeof cls === "string" ) {
clss = cls.split(" ");
} else if ( cls instanceof Array ) {
clss = cls;
}
var i = 0, len = clss.length;
for(; i < len ; i++ )
el.classList.add(clss[i]);
}
document.getElementById("testDiv").className = '';
Ready to run.
Test | Ops/sec | |
---|---|---|
jquery addClass |
| ready |
DOM classList |
| ready |
Zepto addClass |
| ready |
DOM classList with wrapper |
| ready |
DOM classList (no ready) |
| ready |
DOM classList multiple |
| ready |
Native (no classList) |
| ready |
Native |
| ready |
Clear Class Name |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.