Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Chrome 88
Windows 7
Desktop
2 years ago
Test name Executions per second
parseInt a number 418316.2 Ops/sec
parseInt a string 337477.8 Ops/sec
toString a number 4177423.0 Ops/sec
toString a string 5609784.0 Ops/sec
string literal a number 7662893.0 Ops/sec
string literal a string 5627332.0 Ops/sec
add empty string to number 7462003.0 Ops/sec
add empty string to string 6944279.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