Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Firefox 49
Windows 7
Other
7 years ago
Test name Executions per second
getElementById 5416725.0 Ops/sec
getElementsByClassName 1693684.0 Ops/sec
querySelector 2761467.0 Ops/sec
querySelectorAll 812713.8 Ops/sec
jQuery 1186420.0 Ops/sec
jQuery + getElementById 1355741.0 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