jQuery hide() vs addclass("hidden") (v2)

Revision 2 of this benchmark created by Matt Ebel on


Description

Test the performance for $.hide() and .show() as compared to adding and removing a class of "hidden"

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<p class="testp">Test 1</p>

Test runner

Ready to run.

Testing in
TestOps/sec
$.hide and $.show
$(".testp").hide();
$(".testp").show();
ready
addClass() and removeClass()
$(".testp").addClass("hidden");
$(".testp").removeClass("hidden");
ready

Revisions

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

  • Revision 2: published by Matt Ebel on