.first() vs :first vs eq(0) (v18)

Revision 18 of this benchmark created by Washington Botelho on


Description

which is faster .first(), :first or .eq(0)?

Stack Overflow Question: http://stackoverflow.com/questions/2312761/jquery-first-vs-first

Preparation HTML

<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>

<div></div>
<div></div>
<div></div>

Test runner

Ready to run.

Testing in
TestOps/sec
.first()
$('div').first();
ready
:first
$('div :first');
ready
.eq(0)
$('div').eq(0);
ready

Revisions

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