native JS v. jQuery ($ and attr) (v6)

Revision 6 of this benchmark created by Mauricio Wolff on


Preparation HTML

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

<div id="boom">
<p>Hey...</p>
</div>
<script>
  var undo = function() {
   document.getElementById("bam").id = "boom";
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
$("#boom").attr("id", "bam");
undo();
ready
native1
document.getElementById("boom").id = "bam";
undo();
ready
native2
document.getElementById("boom").setAttribute("id", "bam");
undo();
ready

Revisions

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

  • Revision 1: published by willh on
  • Revision 6: published by Mauricio Wolff on