Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
parseInt a number 734823.7 Ops/sec
parseInt a string 621564.9 Ops/sec
toString a number 6779092.0 Ops/sec
toString a string 8570621.0 Ops/sec
string literal a number 12719622.0 Ops/sec
string literal a string 9067979.0 Ops/sec
add empty string to number 12651830.0 Ops/sec
add empty string to string 11835780.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