selector vs find (v7)

Revision 7 of this benchmark created by Matt on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<html>
        <head>
                <title></title>
        </head>
        <body>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div id="div1">
                        <h2>
                                h2
                        </h2>
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
                <div>
                        stuff
                </div>
        </body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
selector
$("#div1 h2")
ready
find
$("#div1").find("h2")
ready

Revisions

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