Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Chrome 92
Windows 7
Desktop
3 years ago
Test name Executions per second
parseInt a number 151448.5 Ops/sec
parseInt a string 146551.3 Ops/sec
toString a number 1447358.1 Ops/sec
toString a string 1814160.0 Ops/sec
string literal a number 2680080.8 Ops/sec
string literal a string 2038468.8 Ops/sec
add empty string to number 2660795.2 Ops/sec
add empty string to string 2402388.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