arpfloat icon indicating copy to clipboard operation
arpfloat copied to clipboard

Performance & memory optimized?

Open dumblob opened this issue 2 years ago • 3 comments

I wonder (before diving into the implementation) if this lib employs efficiency optimizations as e.g. mpdecimal does?

E.g. if I will specify the float to be 8192 bits wide, then use it only to store IEEE754-exact numbers (i.e. those representable without any precision loss) and being in the interval 1.0..10.0 (yes, this small), will it immediately allocate enormous amount of memory and then do the computation with all the bits or will it allocate some "minimum" and do only a fraction of all the computations?

In other words, does it support on demand allocation of memory?

dumblob avatar Jan 01 '23 22:01 dumblob

Float<> is statically allocated to the maximum size. However, some algorithms (division at the moment) reduce the size of the word before performing the computation.

nadavrot avatar Jan 04 '23 22:01 nadavrot

Thanks for clarification. Do you think it would make sense to implement such "deferred" incremental allocation? Or is it out of scope for this lib?

dumblob avatar Jan 04 '23 22:01 dumblob

Maybe the decision to go with static allocation was not the right decision. I ran into trouble in operations that require higher precision and would benefit from dynamic extension of precision, which you can't easily do with static allocation.

nadavrot avatar Jan 06 '23 05:01 nadavrot