Vanilla JS V Jquery Hide (v3)

Revision 3 of this benchmark created by Ben on


Description

Proof That Jquery SUCKS!!!.. Actually just testing this http://forum.yola.com/yola/topics/whyjqueryisbetterthanregularjavascript

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Jquery
$('#Stupid_Div').hide().show().hide();
ready
Vanilla JS
document.getElementById("Stupid_Div").style.display = "none";
document.getElementById("Stupid_Div").style.display = "block";
document.getElementById("Stupid_Div").style.display = "none";
ready
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;
ready
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;
ready

Revisions

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