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.2 Ops/sec
toString a number 4489478.0 Ops/sec
toString a string 22242738.0 Ops/sec
string literal a number 4594748.5 Ops/sec
string literal a string 24887598.0 Ops/sec
add empty string to number 4463590.5 Ops/sec
add empty string to string 18094142.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