select all but first

JavaScript performance comparison

Test case created by Anirudh

Info

Select all but first item in jquery.

Source: http://stackoverflow.com/questions/9465193/gt0-vs-notfirst

Preparation code

<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>

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

Preparation code output

1 1 1 1 1 1 1 1 1 1 1 1 1 1

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
gt(0)
var items = $("span:gt(0)");
pending…
not:first
var items = $("span:not(:first)");
pending…
slice
var items = $("span").slice(1);
pending…

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

Compare results of other browsers

0 comments

Add a comment