child-or-find

JavaScript performance comparison

Test case created by anton

Info

Compare $(".some > .child") CSS selector vs $('.some').find('.child');

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="promo-news">
  <div class="column-header">Some Header Data</div>
  <div class="column-content">Some Content Data</div>
</div>
<script>
Benchmark.prototype.setup = function() {
    var newsContent;
};
</script>

Preparation code output

Some Header Data
Some Content Data

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
child
newsContent = $('.promo-news > .column-content');
pending…
find
newsContent = $('.promo-news').find('.column-content');
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

Add a comment