[Python-Dev] Decimal news: speedup and stabilization

Facundo Batista facundobatista at gmail.com
Fri Nov 23 19:19:54 CET 2007


Hi people!

Two news. A big speed up, and now we reached some stable state.


Mark Dickinson found out that a lot of time was lost internally in
decimal.py when dealing with the Decimal mantissas.

He changed the way that mantissa was stored, from a tuple of ints, to
a plain string (each character a digit). This achieved a speedup of
around a 40%!!!

Three notes:

- The speedup was measured using two tools I created [*], one
basically tries a lot of use cases, the other use the specification
test cases. Both generate a .py which actually measures the times.

- No API was changed, and this a good thing, :)

- The change is somewhat big. But as the speedup is important, and the
API es untouched, I considered it was something that worths it.


After several months with a lot of work here, no more big changes are
planned to this module, so I will backport it to 2.5.3 (when the trunk
gets unfrozen). Note that the module complies with the latest
specification and with the latest test cases (that are from one month
ago!).

Thanks Mark for all your effort here!

[*]  http://tools.assembla.com/svn/homedevel/decimal/

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list