Data Selector Performance (v55)

Revision 55 of this benchmark created by Middendorf on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js">
</script>
<ul id="test">
</ul>

Setup

var i = 500;
    var ul = $("#test");
    ul.html('');
    while (i > 0) {
      ul.append("<li data-component=\"list-item\" data-bla=\"blub\" class=\"list-item my-other-class\">List Item " + i.toString() + "</li>");
      i -= 1;
    }

Teardown


    ul.html('');
  

Test runner

Ready to run.

Testing in
TestOps/sec
dataSelector
$("[data-component=\"list-item\"]", ul)
ready
classSelector
$(".list-item", ul)
ready
two classes
$(".list-item.my-other-class", ul)
ready
just data attribute
$("[data-component]", ul)
ready
2 dataSelector
$("[data-component=\"list-item\"][data-bla=\"blub\" ]", ul)
ready
dataSelecor Filter
$(".list-item", ul).filter("[data-component=\"list-item\"][data-bla=\"blub\" ]")
ready
class and dataselector
$(".list-item[data-component=\"list-item\"][data-bla=\"blub\" ]", ul)
ready

Revisions

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