Tests:
  • let number = +'100'

  • let number = parseInt('100')

  • let str = "" + 100

  • let str = String(100)

  • let number = Number("100")

  • let bool = !!1

  • let bool = Boolean(1)

  • let str = new String(100)

  • let number = 100

  • let number = new Number("100")

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    let number = +'100'
    let number = parseInt('100')
    let str = "" + 100
    let str = String(100)
    let number = Number("100")
    let bool = !!1
    let bool = Boolean(1)
    let str = new String(100)
    let number = 100
    let number = new Number("100")

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 18 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130 on Windows
View result in a separate tab
Test name Executions per second
let number = +'100' 104677912.0 Ops/sec
let number = parseInt('100') 8546226.0 Ops/sec
let str = "" + 100 102924360.0 Ops/sec
let str = String(100) 8193978.5 Ops/sec
let number = Number("100") 8638681.0 Ops/sec
let bool = !!1 107816104.0 Ops/sec
let bool = Boolean(1) 8542353.0 Ops/sec
let str = new String(100) 8712519.0 Ops/sec
let number = 100 105781600.0 Ops/sec
let number = new Number("100") 7142400.0 Ops/sec


;