cached jquery selector 2015 v3

JavaScript performance comparison

Test case created by Lars and last updated

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<div id="myElement" class="myElement">
 <span></span>
 <span></span>
 <span></span>
 <span></span>
 <span></span>
 <span></span>
</div>
    

Preparation code output

<div id="myElement" class="myElement"> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> </div>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
with-find
$('.myElement').find('span').css('color', 'green');
pending…
without-find
$('.myElement span').css('color', 'green');
pending…

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

Compare results of other browsers

0 Comments