scroped selector vs find jquery

JavaScript performance comparison

Test case created by TheSisb

Preparation code

<script src=""></script>

<div id='ee'>
  <div class='aa'></div>
  <div class='bb'></div>
  <div class='cc'></div>
  <div class='dd'></div>
  <div class='ff'></div>
Benchmark.prototype.setup = function() {
    var $el = $('#ee');

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
scoped select
$('.ff', $el).each(function() {
  return true;
find jquery
$el.find('.ff').each(function() {
  return true;

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

Compare results of other browsers


Comment form temporarily disabled.

Add a comment