Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0
Firefox 85
Ubuntu
Desktop
3 years ago
Test name Executions per second
getElementById 5385922.0 Ops/sec
jQuery (tag.id) 724063.1 Ops/sec
jQuery (tag#id) 665832.9 Ops/sec
jQuery (.id) 1192327.6 Ops/sec
jQuery (#id) 5075239.0 Ops/sec
Cash + getElementsByClassName 1935206.5 Ops/sec
Cash + getElementById 3387285.0 Ops/sec
Cash (tag.id) 1182976.9 Ops/sec
jQuery + getElementById 3557052.0 Ops/sec
Cash (tag#id) 1074486.2 Ops/sec
Cash (#id) 5057973.5 Ops/sec
querySelectorAll (.id) 1613327.2 Ops/sec
querySelectorAll (#id) 1445792.0 Ops/sec
querySelector (.id) 4296793.5 Ops/sec
querySelector (#id) 4306723.0 Ops/sec
getElementsByTagName 4194641.5 Ops/sec
getElementsByClassName 3058863.5 Ops/sec
Cash (.id) 1843320.4 Ops/sec
jQuery + getElementsByClassName 931169.1 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


;