This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Speed up decimal object construction
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: ncoghlan, rhettinger
Priority: normal Keywords: patch

Created on 2006-06-24 17:19 by ncoghlan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
decimal_construction_speed.diff ncoghlan, 2006-06-24 17:19 Construction speedup for decimal module
Messages (2)
msg50526 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-06-24 17:19
The numerical programming discussion on python-dev
reminded me to try out the new profiler on the decimal
module.

It showed more than a quarter of the execution time for
the unit tests was being spent in decimal.__new__ and
in doing isinstance checks.

This patch adds fast paths that avoids the isinstance
checks when dealing solely with builtin types. It also
caches a couple of incidental values when checking for
special Decimal values during construction from a
string instead of making the same function calls twice.

However, while the speed benefit was significant under
profiling (saving around 15 seconds on the 60 second
runtime of the decimal unit tests), it was far less
impressive under normal operation (saving around 0.5
seconds on the 12.5 second run time of the unit tests,
and around 5 seconds on the 530+ seconds needed to run
the full telco.py benchmark).

So it's definitely faster, but the real magnitude of
the benefit is still an open question.
msg50527 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2006-06-25 02:30
Logged In: YES 
user_id=1038590

Raymond suggested the minor speed improvement wasn't worth
the additional code complexity. I agree with that sentiment,
so this one goes into the bit bucket.
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43544
2006-06-24 17:19:58ncoghlancreate