Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128
Mac OS X 10.15.7
Desktop
4 months ago
Test name Executions per second
No conversion 12345770.0 Ops/sec
parseInt 4777230.0 Ops/sec
Number 4651345.0 Ops/sec
Script Preparation code:
AخA
 
var intA = 42.034;
var strB = "42.034";
Tests:
  • No conversion

     
    var res = intA + strB;
  • parseInt

     
    var res = parseInt(intA) + parseInt(strB);
  • Number

     
    var res = Number(intA) + Number(strB);