Vanilla JS V Jquery Hide

JavaScript performance comparison

Revision 6 of this test case created by

Preparation code

<div id="Stupid_Div">
  Stupid Crap
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
    

Preparation code output

<div id="Stupid_Div"> Stupid Crap </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Jquery
$('#Stupid_Div').hide().show().hide();
pending…
Vanilla JS
document.getElementById("Stupid_Div").style.display = "none";
document.getElementById("Stupid_Div").style.display = "block";
document.getElementById("Stupid_Div").style.display = "none";
pending…
Vanilla JS Retarded Suggestion
var hide = "none"; //this var isnt needed
var show = "block"; //this var isnt needed
document.getElementById("Stupid_Div").style.display = hide;
document.getElementById("Stupid_Div").style.display = show;
document.getElementById("Stupid_Div").style.display = hide;
pending…
Vanilla JS Cache-Everything Option
var hide = "none",
  show = "block",
  elem = document.getElementById("Stupid_Div");
elem.style.display = hide;
elem.style.display = show;
elem.style.display = hide;
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.

0 Comments

Stupid Crap