svetlo-id

JavaScript performance comparison

Revision 3 of this test case created by Vladimir Carrer

Preparation code

<div id="test">
<p>a</p><p>a</p><p>a</p><p>a</p><p class="hello">a</p><p>a</p><p class="world">a</p><p>a</p><p>a</p><p>a</p><p>a</p>
</div>
<script>
  var a = Array.prototype.slice.call(document.querySelectorAll('#test'));
  
  var b = document.querySelectorAll('#test');
  
  var c = document.getElementById('test');
  
  var d = document.querySelectorAll.call(document, '#test');
</script>
    

Preparation code output

<div id="test"> <p>a</p><p>a</p><p>a</p><p>a</p><p class="hello">a</p><p>a</p><p class="world">a</p><p>a</p><p>a</p><p>a</p><p>a</p> </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Svetlo - Selector Engine (ID)
a[0].nodeName;
pending…
Native querySelectorAll
b[0].nodeName;
pending…
Native getElementById
c.nodeName;
pending…
QSA - Selector Engine(core)
d[0].nodeName;
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.

0 Comments

a

a

a

a

a

a

a

a

a

a

a