querySelector vs getElementById (v2)

Revision 2 of this benchmark created on


Preparation HTML

<span id="hello">Hello</span>

Test runner

Ready to run.

Testing in
TestOps/sec
Query selector
const element = document.querySelector("#hello");
ready
Get element by ID
const element = document.getElementById("hello");
ready

Revisions

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