querySelectorAll vs getElementById

Benchmark created by Andrew Hedges on


Preparation HTML

<p id="foo">bar</p>

Test runner

Ready to run.

Testing in
TestOps/sec
querySelectorAll
var result = document.querySelectorAll('#foo');
ready
getElementById
var result = document.getElementById('#foo');
ready

Revisions

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