addClass removeClass js performance comparison (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.0-rc.1/jquery.mobile-1.4.0-rc.1.min.js"></script>
<script src="http://zeptojs.com/zepto.min.js"></script>
<script src="http://cdn.app-framework-software.intel.com/1.2/jq.mobi.min.js"></script>
<script src="http://bytes1.dyndns.org/BSI/website-app.js"></script>
<script src="http://175.98.115.104/jsperf_js/tt.min.js"></script>

<div id="helloDiv"></div>
<style> 
        .class1 { color: red; }
</style>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
jQuery("#helloDiv").addClass("class2");
ready
jqmobi
jq("#helloDiv").addClass("class2");
ready
zepto
Zepto("#helloDiv").addClass("class2");
ready
tt
tt("#helloDiv").addClass("class2");
ready
jquery add removeClass
jQuery("#helloDiv").removeClass("class1").addClass("class3");
ready
jqmobi add removeClass
jq("#helloDiv").removeClass("class1").addClass("class3");
ready
zepto add removeClass
Zepto("#helloDiv").removeClass("class1").addClass("class3");
ready
tt add removeClass
tt("#helloDiv").removeClass("class1").addClass("class3");
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.