Run details:
Mozilla/5.0 (Linux; Android 12; SM-N975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36
Chrome Mobile 112
Android
Mobile
one year ago
Test name Executions per second
someFloat.toFixed(2); 4289698.5 Ops/sec
Math.round(someFloat * 100) / 100; 3824472.5 Ops/sec
((someFloat * 100) | 0 ) / 100; 11622679.0 Ops/sec
Script Preparation code:
Tests:
  • someFloat.toFixed(2);

  • Math.round(someFloat * 100) / 100;

  • ((someFloat * 100) | 0 ) / 100;