id_tags

JavaScript performance comparison

Revision 39 of this test case created by jayli

Info

id tag 的性能比较

Preparation code

<div id="a">
<p class="test">Foo</p>
<p class="test">Baz</p>
<p class="test">Bar</p>
<p class="test">Foo</p>
<p class="test">Baz</p>
<p class="test">Bar</p>
<p class="test">Foo</p>
<p class="test">Baz</p>
<p class="test">Bar</p>


</div>
<script src="http://a.tbcdn.cn/s/kissy/1.3.0/kissy-min.js"></script>
<script src="http://zeptojs.com/zepto.min.js"></script>

Preparation code output

Foo

Baz

Bar

Foo

Baz

Bar

Foo

Baz

Bar

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
KISSY.all
var bar = KISSY.all('#a p');
pending…
KISSY链式调用
var bar = KISSY.one('#a').all('p');
pending…
querySelector
var bar = document.querySelectorAll("#a p");
pending…
链式querySelector+getByTagName
var bar = document.querySelector("#a").getElementsByTagName("p");
pending…
链式getElementById+getByTagName
var bar = document.getElementById("a").getElementsByTagName("p");
pending…
Zepto
var bar = $('#a p');
pending…
链式Zepto
var bar = $('#a').find('p');
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