Message105663
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 |
|
Date |
User |
Action |
Args |
2010-05-13 21:50:48 | belopolsky | set | recipients:
+ belopolsky, rhettinger, mark.dickinson, draghuram, stutzbach |
2010-05-13 21:50:45 | belopolsky | link | issue8692 messages |
2010-05-13 21:50:45 | belopolsky | create | |
|