[Patches] [ python-Patches-1020845 ] Decimal performance enhancements

SourceForge.net noreply at sourceforge.net
Tue Sep 7 07:05:18 CEST 2004


Patches item #1020845, was opened at 2004-09-01 19:08
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1020845&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Coghlan (ncoghlan)
>Assigned to: Facundo Batista (facundobatista)
Summary: Decimal performance enhancements

Initial Comment:
The attached patch implements a collection of
performance enhancements for decimal.py. They are
currently focused on the performance of the telco
benchmark in the sandbox (i.e. they aim to speed up
instantiation, addition, multiplication and quantization).

The main strategy used (a subclass for NaN and infinite
values) can be extended to encompass more methods in
order to improve performance in other situations.

There is one non-performance related change included -
the '_sign' attribute is renamed to '_isneg' to better
reflect the boolean nature of the property.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-09-07 00:05

Message:
Logged In: YES 
user_id=80475

Facundo, do you have time to look at this one?

We need to:

* revert the _isneg variable name change

* find out why it gives a 2:1 gain on telco but only 10% on
test_decimal.py

* make sure the API has not changed in a way that will make
it more difficult someday to convert this into C and make it
a built-in.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-09-02 00:18

Message:
Logged In: YES 
user_id=80475

Nice job.  The timings do improve and the approach is
reasonable.

Please go ahead to the next step and polish it up.

Also, please change _isneg back to _sign.  That matches the
terminology in the spec, the machine centric sign bit
viewpoint of 754R, and the components of the user visible
as_tuple() method.

The goal is to make the patch as minimal as possible, to
keep the API unchanged, and improve performance.

Using the __new__ method was smart.  That more closely
corresponds to a potential C implementation of an immutable
type.

----------------------------------------------------------------------

Comment By: Nick Coghlan (ncoghlan)
Date: 2004-09-01 19:11

Message:
Logged In: YES 
user_id=1038590

I forgot to add that this is NOT yet a production quality
patch. The doc strings, in particular, need work. I'm mainly
posting it so Raymond can have a look at it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1020845&group_id=5470


More information about the Patches mailing list