Data Selector Performance

JavaScript performance comparison

Revision 33 of this test case created by

Preparation code

<ul id="test" style="display:none;">
</ul>
      
<script>
Benchmark.prototype.setup = function() {
  var i = 500;
  var ul = document.getElementById("test");
  var els = [];
  
  ul.innerHTML = '';
  
  while (i > 0) {
    els.push('<li data-component-list-item data-component-order="' + i + '" class="list-item my-other-class">List Item ' + i + '</li>');
    i -= 1;
  }
  ul.innerHTML = els.join('');

};
</script>

Preparation code output

<ul id="test" style="display:none;"> </ul>

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
dataSelector
ul.querySelectorAll("[data-component-list-item]")
pending…
classSelector
ul.querySelectorAll(".list-item")
pending…
two classes
ul.querySelectorAll(".list-item.my-other-class")
pending…
dataSelector - value
ul.querySelectorAll("[data-component-order='1']")
pending…
dataSelector - endsWith value
ul.querySelectorAll("[data-component-order$='1']")
pending…
dataSelector - startsWith value
ul.querySelectorAll("[data-component-order^='1']")
pending…
class + dataSelector
ul.querySelectorAll(".list-item[data-component-list-item]")
pending…
class + dataSelector /w value
ul.querySelectorAll(".list-item[data-component-order='1']")
pending…
class + dataSelector /w startsWith
ul.querySelectorAll(".list-item[data-component-order^='1']")
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