chewxy / math32

A float32 version of Go's math package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Performance f32 vs f64

Claus1 opened this issue · comments

How different is the library performance vs go standard math in average?

I have not tested it but I imagine on 64bit systems this library would perform as similar or worse than math package.

My understanding is that this library does not seek to beat math speed, which is already optimized with assembly all over the place. math32 is a option for when you need to work with float32's i.e:

  • Working with an external interface that accepts float32, such as graphics libraries (OpenGL, WebGL)
  • Working on <=32bit systems with no FPU such as microcontrollers (see TinyGo)

I wasn't aware of it before but working with float32 slices can speed up programs in certain cases since more data fits on a cache line.