Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763
Edge 18.17763
Windows
Desktop
5 years ago
Test name Executions per second
impicit elementId 9627.1 Ops/sec
explicit getElementById 21542.9 Ops/sec
id function 21099.6 Ops/sec
id var function 21594.3 Ops/sec
id var arrow function 21679.8 Ops/sec
element var 25458.8 Ops/sec
var element in block scope 23655.9 Ops/sec
let element in block scope 23128.3 Ops/sec
const element in block scope 24862.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • impicit elementId

  • explicit getElementById

  • id function

  • id var function

  • id var arrow function

  • element var

  • var element in block scope

  • let element in block scope

  • const element in block scope