Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36
Chrome 74
Mac OS X 10.14.4
Desktop
5 years ago
Test name Executions per second
Vanilla getElementById(id) 3019636.8 Ops/sec
Vanilla querySelector(#id) 1586494.5 Ops/sec
Vanilla querySelectorAll(#id) 550479.4 Ops/sec
jQuery(#id) 738122.2 Ops/sec
HTML Preparation code:
Tests:
  • Vanilla getElementById(id)

  • Vanilla querySelector(#id)

  • Vanilla querySelectorAll(#id)

  • jQuery(#id)