Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Chrome 140
Windows
Desktop
one year ago
Benchmark.js
getElementById
52.8M/s
getElementsByTagName
25.5M/s
querySelector by attribute (partial matching) - variant (starts with)
8.2M/s
querySelector by attribute (partial matching)
7.9M/s
View exact numbers
Test name Executions per second
getElementById 52,838,068 Ops/sec
getElementsByTagName 25,504,134 Ops/sec
querySelector by attribute (partial matching) - variant (starts with) 8,198,428 Ops/sec
querySelector by attribute (partial matching) 7,881,928 Ops/sec
HTML Preparation code:
Tests: