jQuery Dumb Hide

JavaScript performance comparison

Revision 2 of this test case created

Info

jQuery().hide() is a bit redundant. let's test just how redundant it is.

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
Benchmark.prototype.setup = function() {
    var temp = $('<div />').appendTo(document.body);
    var node = temp[0];
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
hide 1
temp.hide();
temp.show();
pending…
hide 2
temp.hide(0);
temp.show();
pending…
css
temp.css('display', 'none');
temp.css('display', 'block');
pending…
raw
node.style.display = 'none';
node.style.display = 'block';
pending…
hidden
node.hidden = true;
node.hidden = false;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment