[pypy-issue] Issue #1931: slower factorial compared to CPython (pypy/pypy)

Philip Nguyen issues-reply at bitbucket.org
Thu Nov 20 21:57:22 CET 2014


New issue 1931: slower factorial compared to CPython
https://bitbucket.org/pypy/pypy/issue/1931/slower-factorial-compared-to-cpython

Philip Nguyen:

The following program runs slower with PyPy than CPython on my computer:


```
#!python

import time

def prod(n):
    p = 1
    for i in range(1, n + 1):
        p *= i
    return p

start = time.time()
prod(100000)
end = time.time()
print "prod: %s" % (end - start)
```

`PyPy 2.3.1` takes **3.5s**, while `CPython 2.7.8` takes **2.8s**. This is `Ubuntu 14.10 64bit` on `Core i7 3667U`.




More information about the pypy-issue mailing list