Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
parseInt a number 2077743.0 Ops/sec
parseInt a string 1766829.6 Ops/sec
toString a number 7027286.5 Ops/sec
toString a string 23066542.0 Ops/sec
string literal a number 12227090.0 Ops/sec
string literal a string 22910070.0 Ops/sec
add empty string to number 5897549.0 Ops/sec
add empty string to string 11891828.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