[pypy-issue] [issue1488] Times slower in PyPy
Nick Zorin
tracker at bugs.pypy.org
Fri May 17 09:29:11 CEST 2013
New submission from Nick Zorin <3.14l5926 at gmail.com>:
This code works several times slower in PyPy comparing to Python.
import time
def timeit(f):
def timed(*args, **kw):
ts = time.time()
result = f(*args, **kw)
te = time.time()
print 'func:%r args:[%r, %r] took: %2.4f sec' % \
(f.__name__, args, kw, te-ts)
return result
return timed
def fib():
i = 1
a = b = c = 0
while True:
if i == 1:
a = 0
result = a
elif i == 2:
b = 1
result = 2
else:
c = a + b
result = c
a, b = b, c
i += 1
if '31415926' in str(result):
yield i
@timeit
def xxx(f):
f.next()
f.next()
f.next()
f.next()
f.next()
f = fib()
xxx(f)
----------
messages: 5734
nosy: 314l5926, pypy-issue
priority: performance bug
release: 2.0
status: unread
title: Times slower in PyPy
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1488>
________________________________________
More information about the pypy-issue
mailing list