[issue12080] decimal.py: performance in _power_exact

2011-06-04 Thread Stefan Krah

Stefan Krah  added the comment:

Mark Dickinson  wrote:
> Here's a patch. Stefan, could you please review?

Mark, sorry for not replying earlier. The patch looks great.

I've also tested the patch in practice: I ran 700,000,000 random tests with
an exponent range of [-9, 9]. This took three days.

Without the patch, this would have been impossible; the range had to be
restricted to [-, ].

Unfortunately I got sidetracked reviewing the rest of the function (today
I started out on a mechanical proof of the nth-root part).

I *did* review the changes though, and I think they are correct.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-06-04 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed for 3.3 and 2.7.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-06-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 78d79499e7de by Mark Dickinson in branch '2.7':
Issue #12080: Fix a performance issue in Decimal._power_exact that caused some 
corner-case Decimal.__pow__ calls to take an unreasonably long time.
http://hg.python.org/cpython/rev/78d79499e7de

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-06-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c3fe54781244 by Mark Dickinson in branch 'default':
Issue #12080: Fix a performance issue in Decimal._power_exact that causes some 
corner-case Decimal.__pow__ calls to take an unreasonably long time.
http://hg.python.org/cpython/rev/c3fe54781244

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a slightly improved version that adds guards against computing 10**ye 
for large ye in the case y < 0, ye > 0.

--
Added file: http://bugs.python.org/file22069/issue12080_v2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-22 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage:  -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a patch. Stefan, could you please review?

--
keywords: +patch
Added file: http://bugs.python.org/file22068/issue12080.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-15 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the report;  I'll try to find some time to look at this.

This isn't the first time that I've thought that it might be better just to 
abandon the aim of getting correctly-rounded results for pow.

--
assignee:  -> mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12080] decimal.py: performance in _power_exact

2011-05-15 Thread Stefan Krah

New submission from Stefan Krah :

I found another performance issue in _power_exact:

>>> Decimal(4) ** Decimal("-1.2e-9")
^CTraceback (most recent call last):
  File "", line 1, in 
  File "/home/stefan/pydev/cpython/Lib/decimal.py", line 2343, in __pow__
ans = self._power_exact(other, context.prec + 1)
  File "/home/stefan/pydev/cpython/Lib/decimal.py", line 2098, in _power_exact
ten_pow = 10**-ye
KeyboardInterrupt



This one is in the power operation in line 2098. There are several
other places where huge integer powers are calculated if 'ye' is
sufficiently large.

--
components: Library (Lib)
messages: 136022
nosy: mark.dickinson, skrah
priority: normal
severity: normal
status: open
title: decimal.py: performance in _power_exact
type: performance
versions: Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com