Tests:
  • Intl

    AخA
     
    new Intl.NumberFormat('en-US', {
        style: 'decimal',
        minimumFractionDigits: 0,
        maximumFractionDigits: 3,
      }).format('100000.234')
  • String

    x
     
    const value = '100000.234';
      // fix for rounding issues, see Mozilla docs on method toFixed()
      const normalizedValue = value * 10 ** 3;
      const formattedValue = normalizedValue.toFixed(0);
      return +formattedValue / 10 ** 3;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Intl
    String

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.69
Chrome 97 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Intl 20268.1 Ops/sec
String 2543998.5 Ops/sec