Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Firefox 75
Windows
Desktop
4 years ago
Test name Executions per second
Floar 76444720.0 Ops/sec
toFixed 6450464.5 Ops/sec
static mult 386902176.0 Ops/sec
Script Preparation code:
x
 
var float = 0.123456789;
var fixes = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000];
var fix = 2;
Tests:
  • Floar

     
    ~~(float * fixes[fix]) / fixes[fix];
  • toFixed

     
    +(float.toFixed(fix))
  • static mult

     
    ~~(float * 100) / 2;