OpenWeightlifting
OpenWeightlifting copied to clipboard
Backend: use fixed-point numerics instead of float32 for weights
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.