svetlo-class

JavaScript performance comparison

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('.world'));
  
  var b = document.querySelectorAll('.world');
  
  var c = document.querySelectorAll.call(document, '.world');
</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
for (var i = 0, length = a.length; i < length; i++) {
 a[i].nodeName;
}
pending…
Native querySelectorAll
for (var i = 0, length = b.length; i < length; i++) {
 b[i].nodeName;
}
pending…
QSA - Selector Engine
for (var i = 0, length = c.length; i < length; i++) {
 c[i].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