Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.63
Chrome 110
Windows
Desktop
one year ago
Test name Executions per second
parseInt a number 1075113.2 Ops/sec
parseInt a string 936770.5 Ops/sec
toString a number 9823881.0 Ops/sec
toString a string 11824592.0 Ops/sec
string literal a number 18315592.0 Ops/sec
string literal a string 13396747.0 Ops/sec
add empty string to number 18031372.0 Ops/sec
add empty string to string 16697066.0 Ops/sec
Script Preparation code:
Tests:
  • parseInt a number

  • parseInt a string

  • toString a number

  • toString a string

  • string literal a number

  • string literal a string

  • add empty string to number

  • add empty string to string