jQuery selector vs native (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
  for (var i = 0; i < 1000; i++) {
   $('body').append($('<div id="nr_' + i + '"></div>'));
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
var a = $('#nr_765');
ready
Native
var a = document.getElementById('nr_765');
ready
mixed
var a = $(document.getElementById('nr_765'));
 
ready

Revisions

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