getElementById vs querySelector

Benchmark created on


Preparation HTML

<div id="element-id"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
const element = document.getElementById("element-id");
ready
querySelector
const element = document.querySelector("#element-id");
ready

Revisions

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