Tests:

Historical Performance Data aggregated from 5 community runs

Desktop Results:
Chrome 5 runs
!! (number)
189.3M/s
ternary (number)
181.3M/s
!! (string)
179.8M/s
ternary (string)
179.2M/s
Boolean() (string)
16.5M/s
Boolean() (number)
16.4M/s

Fastest: !! (number) (11.6x faster)

View exact numbers
  • !! (number): 189,288,528 ops/sec
  • ternary (number): 181,303,104 ops/sec
  • !! (string): 179,778,224 ops/sec
  • ternary (string): 179,205,808 ops/sec
  • Boolean() (string): 16,501,763 ops/sec
  • Boolean() (number): 16,360,890 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    !! (number)
    Boolean() (number)
    ternary (number)
    !! (string)
    Boolean() (string)
    ternary (string)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Windows
View result in a separate tab
!! (number)
220.4M/s
ternary (string)
219.9M/s
!! (string)
214.1M/s
ternary (number)
210.6M/s
Boolean() (number)
204.4M/s
Boolean() (string)
197.1M/s
View exact numbers
Test name Executions per second
!! (number) 220,420,480 Ops/sec
ternary (string) 219,856,304 Ops/sec
!! (string) 214,078,304 Ops/sec
ternary (number) 210,615,312 Ops/sec
Boolean() (number) 204,401,040 Ops/sec
Boolean() (string) 197,122,288 Ops/sec