Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
Intl.NumberFormat 72855.7 Ops/sec
Manually calculate 6004531.5 Ops/sec
Tests:
  • Intl.NumberFormat

    AخA
     
    var a = new Intl.NumberFormat([], {minimumFractionDigits: 2, useGrouping: false}).format(1234567.89);
    var z = Number(a);
  • Manually calculate

    x
     
    const a = 1234567.89;
    const t = Math.pow(10, 2 ?? 0);
    const z = Math.min(
      Math.floor(a * t) /
      t,
      100
    );