jQuery Selector full path vs simple path (v3)

Revision 3 of this benchmark created on


Preparation HTML

<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>

<body>
<div id="outer-container">
<div id="inner-containner">
<div id="some-more-containner">
  <ul>
    <li id="li-1">1</li>
    <li id="li-2">2</li>
    <li id="li-3">3</li>
    <li id="li-4">4</li>
    <li id="li-5">5</li>
    <li id="li-6">6</li>
    <li id="li-7">7</li>
    <li id="li-8">8</li>
    <li id="li-9">9</li>
  </ul>
</div>
</div>
</div>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
Full Path
$('div#outer-container div#inner-container div#some-more-container ul li[id^="li-"]');
ready
Simple Path
$('li[id^="li-"]');
ready
Section path
$('body > li[id^="li-"]');
ready
Simple Id
$('#li-8')
ready
Section Id
$('body > #li-8')
ready

Revisions

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