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 1060015.0 Ops/sec
parseInt a string 1126091.0 Ops/sec
toString a number 3497148.0 Ops/sec
toString a string 10893970.0 Ops/sec
string literal a number 5382001.0 Ops/sec
string literal a string 10814410.0 Ops/sec
add empty string to number 4203882.0 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