Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11.2; rv:86.0) Gecko/20100101 Firefox/86.0
Firefox 86
Mac OS X 11.2
Desktop
3 years ago
Test name Executions per second
parseInt a number 12840250.0 Ops/sec
parseInt a string 2307147.0 Ops/sec
toString a number 4489478.0 Ops/sec
toString a string 22242740.0 Ops/sec
string literal a number 4594749.0 Ops/sec
string literal a string 24887600.0 Ops/sec
add empty string to number 4463591.0 Ops/sec
add empty string to string 18094140.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