Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
parseInt a number 824436.6 Ops/sec
parseInt a string 676522.7 Ops/sec
toString a number 6767020.5 Ops/sec
toString a string 8068558.0 Ops/sec
string literal a number 13424072.0 Ops/sec
string literal a string 8686943.0 Ops/sec
add empty string to number 13177407.0 Ops/sec
add empty string to string 12490493.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