Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Firefox 102
Ubuntu
Desktop
2 years ago
Test name Executions per second
parseInt a number 4024696.0 Ops/sec
parseInt a string 2636714.0 Ops/sec
toString a number 2529427.0 Ops/sec
toString a string 30876470.0 Ops/sec
string literal a number 2492551.0 Ops/sec
string literal a string 23150460.0 Ops/sec
add empty string to number 3763071.0 Ops/sec
add empty string to string 35972210.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