index vs parent

JavaScript performance comparison

Test case created

Preparation code

<script src=""></script>
<ul class="tabs"><li style="width: 22.5%;"><a href="#tab-0-0" style="height: 15px;">3,000 - 4,999</a><div></div></li><li style="width: 22.5%;"><a href="#tab-0-1" style="height: 15px;">5,000 - 7,499</a><div></div></li><li class="" style="width: 22.5%;"><a href="#tab-0-2" style="height: 15px;">7,500 - 15,000</a><div></div></li><li class="current" style="width: 22.5%;"><a href="#tab-0-3" style="height: 15px;">15,001 - 25,000</a><div></div></li></ul>
Benchmark.prototype.setup = function() {
    var hash = '#tab-0-1';

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
index eq
var index = $('.tabs a', this).index( $('li a[href$="' + hash + '"]') )
if (index !== -1)
  $('.tabs a', this).eq(hash_index).trigger('click');
find trigger
$('.tabs', this).find($('a[href$="' + hash + '"]')).trigger('click');

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

Compare results of other browsers


Comment form temporarily disabled.

Add a comment