Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
jQuery vs getElementById vs querySelector
Comparing speed of getting element by id with jQuery vs Vanilla JS with getElementById and querySelector
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/129.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 129
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
getElementById
5.1M/s
querySelector
2.7M/s
jQuery
1.9M/s
View exact numbers
Test name
Executions per second
✓
getElementById
5,139,298 Ops/sec
querySelector
2,731,843 Ops/sec
jQuery
1,883,291 Ops/sec
HTML Preparation code:
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.0.min.js"></script> <div id="testElement" class="test class list classes"></div>
Tests:
jQuery
var el = $("#testElement")[0];
getElementById
var el = document.getElementById('testElement');
querySelector
var el = document.querySelector("#testElement");