Run details:
Mozilla/5.0 (Android 4.4.2; Tablet; rv:68.0) Gecko/68.0 Firefox/68.0
Android 4
Android 4.4.2
Tablet
5 years ago
Test name Executions per second
Simple rounding 10991604.0 Ops/sec
Rounding with epsilon and string conversion 184544.5 Ops/sec
Rounding with "if" statement 5203109.5 Ops/sec
Rounding by toLocaleString 954.4 Ops/sec
Script Preparation code:
Tests:
  • Simple rounding

  • Rounding with epsilon and string conversion

  • Rounding with "if" statement

  • Rounding by toLocaleString