[pypy-issue] [issue899] Simple inner loop with mult-op much slower than CPython with/without JIT

Garen Parham tracker at bugs.pypy.org
Sun Oct 9 09:27:03 CEST 2011


New submission from Garen Parham <garen.p at gmail.com>:

$ cat factorial_iterative.py
import sys
def factorial(n):
    result = 1
    for i in xrange(1, n+1):
        result *= i
    return result

if __name__ == '__main__':
    factorial(int(sys.argv[1]))

$ time /opt/python27/bin/python factorial_iterative.py 100000

real    0m5.914s
user    0m5.513s
sys     0m0.358s


$ time ~/dev/pypy-c-jit-47882-3f96afe7cdc2-linux/bin/pypy factorial_iterative.py 
100000


real    0m25.916s
user    0m25.751s
sys     0m0.056s

$ time ~/dev/pypy-c-nojit-47882-3f96afe7cdc2-linux/bin/pypy 
factorial_iterative.py 100000

real    0m25.578s
user    0m25.524s
sys     0m0.051s

----------
messages: 3272
nosy: Garen, pypy-issue
priority: bug
status: unread
title: Simple inner loop with mult-op much slower than CPython with/without JIT

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue899>
________________________________________


More information about the pypy-issue mailing list