OpenWeightlifting icon indicating copy to clipboard operation
OpenWeightlifting copied to clipboard

Backend: use fixed-point numerics instead of float32 for weights

Open sstangl opened this issue 8 months ago • 0 comments

The backend currently represents weights using float32 values. Floating-point arithmetic and comparisons are significantly slower than integer operations and require the use of special floating-point registers.

OpenPowerlifting got a nice speed bump by using a fixed-point representation: a weight like 123.45 is stored as an i32 in the format 12345. Go appears to have an arbitrary-precision fixed-decimal representation through the decimal package, but a representation that hardcodes one decimal point (for i16) or two decimal points (for i32) is likely to be simpler and more performant.

sstangl avatar May 27 '24 16:05 sstangl