A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-October/074986.html below:

[Python-Dev] C Decimal - is there any interest?

[Python-Dev] C Decimal - is there any interest?Daniel Stutzbach daniel.stutzbach at gmail.com
Fri Oct 19 17:36:58 CEST 2007
On 10/19/07, Facundo Batista <facundobatista at gmail.com> wrote:
> 2007/10/16, Daniel Stutzbach <daniel.stutzbach at gmail.com>:
> > 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4