Script Preparation code:
AخA
 
const formatNumberToFloat = new Intl.NumberFormat('ru-RU', {
    style: 'decimal',
    maximumFractionDigits: 2,
    minimumFractionDigits: 2,
})
Tests:
  • Intl.NumberFormat

    x
     
    const formatNumberToFloat = new Intl.NumberFormat('ru-RU', {
        style: 'decimal',
        maximumFractionDigits: 2,
        minimumFractionDigits: 2,
    })
    var a = formatNumberToFloat.format("10000.999999");
  • toLocalString

     
    var a = (Math.round( "10000.999999" * 100 + Number.EPSILON ) / 100).toFixed(2);
    var b = a.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ')
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Intl.NumberFormat
    toLocalString

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0
Firefox 121 on Mac OS X 10.15
View result in a separate tab
Test name Executions per second
Intl.NumberFormat 36439.8 Ops/sec
toLocalString 3229272.0 Ops/sec