jQuery .find() vs. context selector vs non-context selector (v96)

Revision 96 of this benchmark created on


Description

comparing selector speed

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>

<article>
        <p>A test</p>
        <p><ins></ins></p>
        <p>This is text</p>
</article>

Setup

var $article = $('article');

Test runner

Ready to run.

Testing in
TestOps/sec
find method (node context)
var has = $article.find('ins').length > 0 ? true : false;
ready
find method (jquery context)
var has = $('ins', $article).length > 0 ? true : false;
ready

Revisions

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