Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36
Chrome 88
Mac OS X 11.2.1
Desktop
3 years ago
Test name Executions per second
parseInt a number 639751.6 Ops/sec
parseInt a string 530513.6 Ops/sec
toString a number 5764166.0 Ops/sec
toString a string 7433981.0 Ops/sec
string literal a number 11743480.0 Ops/sec
string literal a string 8311100.0 Ops/sec
add empty string to number 11763970.0 Ops/sec
add empty string to string 11005560.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