On Wed, Mar 26, 2008 at 2:57 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote:

> Greg Ewing wrote:
> > I thought Decimal was going to be replaced by a C
> > implementation soon anyway. If so, is it worth going
> > to much trouble over this?
> >
>
> I believe that was found to be more trouble than it was worth. So the
> optimisations focused on various ways of making the Python
> implementation more efficient.
>

I think it's still worth considering a hybrid implementation of Decimal:
C code for the basic integer arithmetic (that is, supply a long int
replacement whose underlying implementation works in base a
power of 10), and Python for all the complicated logic (dealing
with flags, special values, etc.).  This will speed things up in the
usual cases, and also give everything the right asymptotics for
those few people using Decimal to do really high precision arithmetic.
(Right now, addition of two Decimals takes quadratic time.)

The decimal long integer implementation is already in the sandbox,
so this probably isn't as much work as it sounds.  I won't have time
for it until May, though.

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to