Raymond Hettinger wrote:
[Nick Coghlan]
What about decimal-in-C, by the way? Is anyone still working on it?
I'm seeking funding for the project. If it is forthcoming, I intend to do a pure C version that simply implements the spec and then adds wrappers for the pure python interface. That will save the cost of constantly creating and modifying many pyobjects that currently arise during intermediate calculations. It's possible to focus just of the mantissa calculations but the cost of the actual arithmetic work is swapped by the overhead of managing contexts, checking for special values, and memory allocations. Without addressing those, I think decimal will remain critically performance challenged compared to native floats (decimals will never be that fast, but they can get close enough to make them a viable alternative for many kinds of work).
I actually agree with all that, but do you agree the mantissa work is still worthwhile in the near term (i.e. 3.1) to address the 25% or so slowdown between decimal in 2.x (with the mantissa as an 8-bit str) and decimal in 3.0 (with the mantissa as a unicode str, because using a bytes object to store the digits is actually slower due to the lack of a bytes->long fast path)? Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------