Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
Chrome 86
Linux
Desktop
4 years ago
Test name Executions per second
parseInt a number 542569.2 Ops/sec
parseInt a string 390034.5 Ops/sec
toString a number 2830878.2 Ops/sec
toString a string 4038690.5 Ops/sec
string literal a number 9204105.0 Ops/sec
string literal a string 4419266.0 Ops/sec
add empty string to number 9205970.0 Ops/sec
add empty string to string 8592613.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