HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 118 community runs

Desktop Results:
Chrome 104 runs
Round floating number using toFixed()
8K/s
Round floating number using toFixed() and parseFloat
5K/s
Round floating number using lodash round function
3K/s

Fastest: Round floating number using toFixed() (3.0x faster)

View exact numbers
  • Round floating number using toFixed(): 8,156 ops/sec
  • Round floating number using toFixed() and parseFloat: 4,789 ops/sec
  • Round floating number using lodash round function: 2,719 ops/sec
Firefox 9 runs
Round floating number using toFixed()
23K/s
Round floating number using toFixed() and parseFloat
14K/s
Round floating number using lodash round function
2K/s

Fastest: Round floating number using toFixed() (10.9x faster)

View exact numbers
  • Round floating number using toFixed(): 22,639 ops/sec
  • Round floating number using toFixed() and parseFloat: 14,048 ops/sec
  • Round floating number using lodash round function: 2,080 ops/sec
Safari 5 runs
Round floating number using toFixed()
10K/s
Round floating number using toFixed() and parseFloat
6K/s
Round floating number using lodash round function
2K/s

Fastest: Round floating number using toFixed() (4.2x faster)

View exact numbers
  • Round floating number using toFixed(): 9,972 ops/sec
  • Round floating number using toFixed() and parseFloat: 5,834 ops/sec
  • Round floating number using lodash round function: 2,390 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Round floating number using lodash round function
    Round floating number using toFixed()
    Round floating number using toFixed() and parseFloat

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Chrome 147 on Windows
View result in a separate tab
Round floating number using toFixed()
7K/s
Round floating number using toFixed() and parseFloat
4K/s
Round floating number using lodash round function
1K/s
View exact numbers
Test name Executions per second
Round floating number using toFixed() 6,663 Ops/sec
Round floating number using toFixed() and parseFloat 4,302 Ops/sec
Round floating number using lodash round function 1,234 Ops/sec