On 10/19/07, Facundo Batista <[EMAIL PROTECTED]> wrote:
> 2007/10/16, Daniel Stutzbach <[EMAIL PROTECTED]>:
> > I agree.  A basic subquadratic radix conversion algorithm isn't much
> > more complex than the existing quadratic code.  I just whipped
> > together a Python prototype and it's only 15 lines.
>
> Do you have a patch for decimal.py of current trunk?

I don't, though I could make one.

However, currently the int->Decimal conversion takes place in C via
str().  Here's the relevant line from decimal.py:

            self._int = tuple(map(int, str(abs(value))))

Doing some simple experiments, a Python subquadratic routine doesn't
make a big pay off until around 25,000 decimal digits.  On the plus
side, the extra overhead of the additional routine is small and I
didn't observe a noticeable performance penalty for small inputs (my
routine calls str() as a base case for values less than 2**31-1).

So... would the community rather have a Python patch for decimal.py or
a patch for subquadratic versions of long_format and PyLong_FromString
in longobject.c?  The later will be faster and will speed up some
non-Decimal operations as well.

-- 
Daniel Stutzbach, Ph.D.             President, Stutzbach Enterprises LLC
_______________________________________________
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