jq-first-vs-eq

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div>
    <h1>heading</h1>
    <p>How do I select this element with jQuery?</p>
    <p>Another paragraph</p>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
first
var p = $("div p:first");
ready
eq
var p = $("div p").eq(0);
ready
eq-selector
var p = $("div p:eq(0)");
ready

Revisions

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