parentNode vs jQuery parent (v4)

Revision 4 of this benchmark created on


Description

Speed difference between jQuery helper method and raw JS

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
var parent;
var child;
</script>

<div id="parent">
  <div id="child"></div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
messy Blend
child = document.getElementById('child'),
parent = $(child)[0].parentNode;
 
ready
all jQuery
parent = $( '#child' ).parent();
ready
RAW JS MADNESS!!11!!
parent = document.getElementById('child').parentNode;
 
ready

Revisions

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