Data Selector Performance (v58)

Revision 58 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/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\" 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
$("li[data-component=\"list-item\"]", ul)
ready
classSelector
$(".list-item", ul)
ready
two classes
$(".list-item.my-other-class", ul)
ready
find
ul.find("li[data-component=\"list-item\"]")
ready

Revisions

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