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); 4289699.0 Ops/sec
Math.round(someFloat * 100) / 100; 3824473.0 Ops/sec
((someFloat * 100) | 0 ) / 100; 11622680.0 Ops/sec
Script Preparation code:
Tests:
  • someFloat.toFixed(2);

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

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