Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103
Linux
Desktop
one year ago
Test name Executions per second
getElementById 4998156.0 Ops/sec
jQuery (tag.id) 759976.8 Ops/sec
jQuery (tag#id) 708299.2 Ops/sec
jQuery (.id) 1171313.9 Ops/sec
jQuery (#id) 2633821.2 Ops/sec
Cash + getElementsByClassName 1600183.4 Ops/sec
Cash + getElementById 2028246.9 Ops/sec
Cash (tag.id) 1107594.2 Ops/sec
jQuery + getElementById 2184163.2 Ops/sec
Cash (tag#id) 970402.3 Ops/sec
Cash (#id) 2657485.8 Ops/sec
querySelectorAll (.id) 2417948.8 Ops/sec
querySelectorAll (#id) 1592061.8 Ops/sec
querySelector (.id) 4936596.5 Ops/sec
querySelector (#id) 2894756.2 Ops/sec
getElementsByTagName 4233514.0 Ops/sec
getElementsByClassName 3346268.5 Ops/sec
Cash (.id) 1408177.6 Ops/sec
jQuery + getElementsByClassName 933637.9 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