Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Chrome 90
Windows 7
Desktop
3 years ago
Test name Executions per second
parseInt a number 553984.9 Ops/sec
parseInt a string 433537.2 Ops/sec
toString a number 4750193.0 Ops/sec
toString a string 6329777.0 Ops/sec
string literal a number 10611314.0 Ops/sec
string literal a string 7043089.0 Ops/sec
add empty string to number 10433286.0 Ops/sec
add empty string to string 9995760.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