Native properties vs jQuery attr()

Benchmark created by Sam Korn on


Preparation HTML

<div id="myId"></div><script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var el = document.getElementById('myId'),
      res;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Native
res = el.id;
ready
jQuery attr()
res = $(el).attr('id');
ready

Revisions

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

  • Revision 1: published by Sam Korn on