slice-performance-test

JavaScript performance comparison

Test case created by Nick Craver

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<table>
<tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    <td>5</td>
    <td>6</td>
    <td>7</td>
    <td>8</td>
    <td>9</td>
</tr>
</table>

Preparation code output

1 2 3 4 5 6 7 8 9

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
slice
$("tr td").slice(3, 6);
pending…
subset
var subset = $("tr td:nth-child(4)");
for (var i = 4; i < 7; i++) subset.add("tr td:nth-child(" + i + ")");
pending…
:lt(7)
$("tr td:lt(7)").slice(3, 6);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment