Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Chrome 62
Linux
Other
6 years ago
Test name Executions per second
getElementById() 3412915.8 Ops/sec
getElementsByClassName() 2436559.5 Ops/sec
getElementsByTagName() 2767238.8 Ops/sec
querySelector(#id) 2628137.8 Ops/sec
querySelector(.id) 721866.1 Ops/sec
querySelectorAll(#id) 1316972.1 Ops/sec
querySelectorAll(.id) 106668.3 Ops/sec
jQuery(#id) 1356078.1 Ops/sec
jQuery(.id) 743868.2 Ops/sec
jQuery(tag#id) 432564.2 Ops/sec
jQuery(tag.id) 82301.3 Ops/sec
jQuery + getElementById 1459885.1 Ops/sec
jQuery + getElementsByClassName 504983.5 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • getElementsByClassName

  • getElementsByTagName

  • querySelector (#id)

  • querySelector (.id)

  • querySelectorAll (#id)

  • querySelectorAll (.id)

  • Cash (#id)

  • Cash (.id)

  • Cash (tag#id)

  • Cash (tag.id)

  • Cash + getElementById

  • Cash + getElementsByClassName

  • jQuery (#id)

  • jQuery (.id)

  • jQuery (tag#id)

  • jQuery (tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;