New issue 2104: Pypy3 2.4.0 slower than Python 3.4.2 for a function? https://bitbucket.org/pypy/pypy/issues/2104/pypy3-240-slower-than-python-342-for-a
TheLoneWolfling .: With the following code: ``` #!python import random, itertools, timeit def atLeast(a,b,num): return sum(x==y for x,y in itertools.zip_longest(reversed(bin(a).partition('b')[-1]), reversed(bin(b).partition('b')[-1]), fillvalue='0')) >= num print(timeit.timeit(stmt='atLeast(a,b,96)', setup='from __main__ import atLeast\nimport random\na=random.getrandbits(128)\nb=random.getrandbits(128)', number=100000)) ``` I get the following: ``` C:\>python -V Python 3.4.2 C:\>pypy -V Python 3.2.5 (b2091e973da6, Oct 19 2014, 21:25:51) [PyPy 2.4.0 with MSC v.1500 32 bit] C:\>python pypyslow.py 3.167215612926586 C:\>pypy.exe pypyslow.py 3.3733670679044403 ``` Note that Pypy is actually *slower* at running this function than stock Python is. (I am aware that this is a really bad way to write this function, however I know PyPy likes to know about performance regressions. Just because this function is bad doesn't necessarily mean that there aren't any other functions that are well-written that exhibit this same problem.) May be related to #2100. _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue