Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
getElementById, querySelector, querySelectorAll and with if
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 133
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
getElementById
11.6M/s
with iF
11.3M/s
querySelector
4.3M/s
querySelectorAll
1.7M/s
View exact numbers
Test name
Executions per second
✓
getElementById
11,603,176 Ops/sec
with iF
11,347,491 Ops/sec
querySelector
4,260,691 Ops/sec
querySelectorAll
1,688,126 Ops/sec
HTML Preparation code:
<div id="test">Test</div>
Tests:
getElementById
document.getElementById("test");
querySelector
document.querySelector("#test")
querySelectorAll
document.querySelectorAll("#test")
with iF
var sel = '#test'; if (sel[0] === '#') { document.getElementById("test"); } else { document.querySelectorAll("#test") }