Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Chrome 93
Windows
Desktop
3 years ago
Test name Executions per second
parseInt a number 654196.4 Ops/sec
parseInt a string 534356.7 Ops/sec
toString a number 5103988.0 Ops/sec
toString a string 7070162.5 Ops/sec
string literal a number 8909001.0 Ops/sec
string literal a string 6784060.5 Ops/sec
add empty string to number 9773687.0 Ops/sec
add empty string to string 8993960.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