Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 15_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1
Mobile Safari 15
iOS 15.2
Mobile
2 years ago
Test name Executions per second
parseInt a number 1060014.9 Ops/sec
parseInt a string 1126090.6 Ops/sec
toString a number 3497147.8 Ops/sec
toString a string 10893968.0 Ops/sec
string literal a number 5382000.5 Ops/sec
string literal a string 10814411.0 Ops/sec
add empty string to number 4203881.5 Ops/sec
add empty string to string 8148364.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