Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Firefox 88
Linux
Desktop
3 years ago
Test name Executions per second
parseInt a number 1836454.4 Ops/sec
parseInt a string 925766.8 Ops/sec
toString a number 2045336.9 Ops/sec
toString a string 7335094.0 Ops/sec
string literal a number 2074314.2 Ops/sec
string literal a string 7707681.5 Ops/sec
add empty string to number 2025326.1 Ops/sec
add empty string to string 6313145.5 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