Run details:
Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.85 Mobile Safari/537.36
Chrome Mobile 94
Android 8.1.0
Mobile
3 years ago
Test name Executions per second
Round floating number using lodash round function 135.3 Ops/sec
Round floating number using toFixed() 581.9 Ops/sec
Round floating number using toFixed() and parseFloat 256.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • Round floating number using lodash round function

  • Round floating number using toFixed()

  • Round floating number using toFixed() and parseFloat