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
11 months ago
Test name Executions per second
parseInt a number 2077743.0 Ops/sec
parseInt a string 1766830.0 Ops/sec
toString a number 7027287.0 Ops/sec
toString a string 23066540.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 11891830.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