querySelector

Benchmark created on


Preparation HTML

<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div id="specific" class="specific-test" data-attribute="specific-test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>
<div class="test" data-attribute="test"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
Attribute
const test = document.querySelectorAll('[data-attribute="test"]');
ready
Class
const test = document.querySelectorAll('.test');
ready
Specific attribute
const test = document.querySelector('[data-attribute="specific-test"]');
ready
Specific class
const test = document.querySelector('.specific-test');
ready
ID
const test = document.querySelector('#specific-test');
ready

Revisions

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