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.

Author belopolsky
Recipients belopolsky, draghuram, mark.dickinson, rhettinger, stutzbach
Date 2010-05-13.21:50:45
SpamBayes Score 6.998864e-05
Marked as misclassified No
Message-id <AANLkTimpBZCCUoBVQu9o3uLadXBvoaSLaaZoZ9VHOIzo@mail.gmail.com>
In-reply-to <1273786296.56.0.111300439078.issue8692@psf.upfronthosting.co.za>
Content
On Thu, May 13, 2010 at 5:31 PM, Mark Dickinson <report@bugs.python.org> wrote:
> And why are we trying to speed up the pure Python factorial code here?

I would expect that for large factorials the performance will be
determined by the number of long multiplications and the size of
multiplicands.

> I don't imagine that those speed differences are going to translate well to C.

The differences between recursive and non-recursive versions are not
likely to translate well, but the difference (if any) between the
order of multiplication most likely will.

In any case, I am attaching fixed version of factorial4.

$ ./python.exe -m timeit -s "from factorial4 import f0 as f" "f(10000)"
10 loops, best of 3: 65.5 msec per loop
$ ./python.exe -m timeit -s "from factorial4 import f1 as f" "f(10000)"
10 loops, best of 3: 66.9 msec per loop
$ ./python.exe -m timeit -s "from factorial4 import f2 as f" "f(10000)"
10 loops, best of 3: 56.5 msec per loop
$ ./python.exe -m timeit -s "from factorial4 import f3 as f" "f(10000)"
10 loops, best of 3: 63 msec per loop
Files
File name Uploaded
factorial4.py belopolsky, 2010-05-13.21:50:45
History
Date User Action Args
2010-05-13 21:50:48belopolskysetrecipients: + belopolsky, rhettinger, mark.dickinson, draghuram, stutzbach
2010-05-13 21:50:45belopolskylinkissue8692 messages
2010-05-13 21:50:45belopolskycreate