HTML Preparation code:
Tests:

Historical Performance Data aggregated from 7 community runs

Desktop Results:
Chrome 7 runs
The method getElementById()
16.4M/s
The method querySelector()
3.2M/s

Fastest: The method getElementById() (5.1x faster)

View exact numbers
  • The method getElementById(): 16,357,200 ops/sec
  • The method querySelector(): 3,217,793 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    The method getElementById()
    The method querySelector()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Chrome 145 on Mac OS X 10.15.7
View result in a separate tab
The method getElementById()
51.5M/s
The method querySelector()
8.1M/s
View exact numbers
Test name Executions per second
The method getElementById() 51,472,640 Ops/sec
The method querySelector() 8,065,096 Ops/sec