div#id

JavaScript performance comparison

Test case created by Skorney

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
<div>
  some code1-11
</div>
<br />
<span>
  ---
  <i>
    inner
  </i>
</span>
<br />
<div>
  2-22some code
</div>
<h1>
  000
  <i>
    text
  </i>
</h1>
<div>
  some code3-33
</div>
<br />
<span>
  ---
  <i>
    text
  </i>
</span>
<br />
<div>
  4-44some code
</div>
<span>
  777---
  <i>
    inner
    <em>
      sss
    </em>
  </i>
</span>
<div>
  some code5-55
</div>
<br />
<span>
  ---
  <i>
    text
  </i>
</span>
<br />
<div>
  6-66some code
</div>
<span>
  ---
  <i>
    inner
  </i>
</span>
<div id='someid'>
  some code777
</div>
<br />
<span>
  --2-34
  <b>
    text
  </b>
</span>
<br />
<div>
  8-88some code
</div>
<span>
  ---
  <i>
    <a href='#'>a</a>
    inner
  </i>
</span>
<div>
  some code9-99
</div>
<br />
<span>
  ---
  <s>
    text
  </s>
</span>
<div>
  10-1010some code
</div>
<span>
  ---
  <i>
    inner
  </i>
</span>
    

Preparation code output

<div> some code1-11 </div> <br /> <span> --- <i> inner </i> </span> <br /> <div> 2-22some code </div> <h1> 000 <i> text </i> </h1> <div> some code3-33 </div> <br /> <span> --- <i> text </i> </span> <br /> <div> 4-44some code </div> <span> 777--- <i> inner <em> sss </em> </i> </span> <div> some code5-55 </div> <br /> <span> --- <i> text </i> </span> <br /> <div> 6-66some code </div> <span> --- <i> inner </i> </span> <div id='someid'> some code777 </div> <br /> <span> --2-34 <b> text </b> </span> <br /> <div> 8-88some code </div> <span> --- <i> <a href='#'>a</a> inner </i> </span> <div> some code9-99 </div> <br /> <span> --- <s> text </s> </span> <div> 10-1010some code </div> <span> --- <i> inner </i> </span>

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
div#id
$('div#someid')
pending…
#id+filter
$('#someid').filter('div')
pending…

Compare results of other browsers

Revisions

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

0 Comments

some code1-11

--- inner
2-22some code

000 text

some code3-33

--- text
4-44some code
777--- inner sss
some code5-55

--- text
6-66some code
--- inner
some code777

--2-34 text
8-88some code
--- a inner
some code9-99

--- text
10-1010some code
--- inner