Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133
Ubuntu
Desktop
one year ago
Test name Executions per second
typeof -> string 13308329.0 Ops/sec
Object.prototype.toString.call -> string 2643097.8 Ops/sec
typeof -> boolean 7101557.0 Ops/sec
Object.prototype.toString.call -> boolean 2222140.5 Ops/sec
typeof -> object 6138431.0 Ops/sec
Object.prototype.toString.call -> object 1961103.1 Ops/sec
typeof -> function 5764052.0 Ops/sec
Object.prototype.toString.call -> function 2430284.5 Ops/sec
Script Preparation code:
Tests:
  • typeof -> string

  • Object.prototype.toString.call -> string

  • typeof -> boolean

  • Object.prototype.toString.call -> boolean

  • typeof -> object

  • Object.prototype.toString.call -> object

  • typeof -> function

  • Object.prototype.toString.call -> function