New issue 2770: python 3 code slower with pypy3 https://bitbucket.org/pypy/pypy/issues/2770/python-3-code-slower-with-pypy3
lesshaste: The following code was written by someone called Dennis. from functools import lru_cache @lru_cache(maxsize = None) def haf(matrix): n = len(matrix) if n == 2: return matrix[0][1] h = 0 for j in range(1, n): if matrix[0][j] == 0: continue copy = list(matrix) del copy[:j+1:j] copy = list(zip(*copy)) del copy[:j+1:j] h += matrix[0][j] * haf(tuple(copy)) return h If you feed into it the following input (for example): [[0, -1, 0, 0, -1, 1, 1, -1, 1, -1, -1, 1, 1, 0, 1, 1, 1, 0, 1, -1, -1, 0, 0, -1, -1, 0], [-1, 1, 1, 1, -1, 1, -1, 0, 1, -1, 0, 0, -1, 0, 1, 1, 1, 0, 0, -1, 0, 0, -1, -1, -1, 0], [0, 1, 1, -1, 0, 0, 1, 0, 0, -1, 1, 0, -1, 1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 1, 1, -1], [0, 1, -1, 0, -1, 0, 0, 1, 0, 0, -1, 1, 1, -1, -1, -1, 0, 1, -1, 1, -1, 0, 1, 0, 0, -1], [-1, -1, 0, -1, 1, 0, 1, 0, -1, 1, 1, -1, 0, -1, 0, 1, 1, -1, 0, -1, 1, 0, -1, 1, 1, -1], [1, 1, 0, 0, 0, 0, 0, -1, 1, 0, 0, 1, 0, -1, -1, -1, -1, 0, 0, -1, -1, 1, 1, 0, 1, 0], [1, -1, 1, 0, 1, 0, 0, 1, -1, -1, -1, 1, -1, -1, 0, -1, 1, 0, -1, 0, -1, -1, 0, -1, 0, -1], [-1, 0, 0, 1, 0, -1, 1, 0, 1, 0, 0, -1, -1, -1, 1, 0, 0, 1, -1, 1, 1, 0, -1, 0, -1, 1], [1, 1, 0, 0, -1, 1, -1, 1, 0, 0, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1], [-1, -1, -1, 0, 1, 0, -1, 0, 0, 1, -1, 0, 1, 0, 0, 0, -1, -1, 0, -1, 1, 0, -1, -1, -1, 0], [-1, 0, 1, -1, 1, 0, -1, 0, -1, -1, 0, 1, 1, 0, 1, 0, 0, -1, -1, 1, 0, -1, 1, 1, 0, 0], [1, 0, 0, 1, -1, 1 , 1, -1, -1, 0, 1, -1, 1, 0, -1, -1, 1, 1, 1, 0, 1, -1, -1, 0, -1, 1], [1, -1, -1, 1, 0, 0, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 0, 0, -1, 0, 0, -1, 1, -1], [0, 0, 1, -1, -1, -1, -1, -1, -1, 0, 0, 0, -1, 1, -1, 0, 1, -1, 0, 0, 1, -1, -1, 1, 1, 1], [1, 1, -1, -1, 0, -1, 0, 1, 1, 0, 1, -1, -1, -1, -1, 1, 1, -1, 0, 1, 1, 0, 0, -1, 0, 1], [1, 1, 0, -1, 1, -1, -1, 0, 1, 0, 0, -1, 1, 0, 1, 1, 0, 1, -1, 1, 1, 1, -1, 1, 1, -1], [1, 1, 0, 0, 1, -1, 1, 0, 1, -1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 1, 0], [0, 0, 0, 1, -1, 0, 0, 1, 1, -1, -1, 1, -1, -1, -1, 1, 0, 0, -1, -1, 0, 0, 1, 1, 1, 0], [1, 0, -1, -1, 0, 0, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, 1, -1, -1, 1, 0, 1, -1, 0, -1, -1], [-1, -1, 0, 1, -1, -1, 0, 1, 1, -1, 1, 0, 0, 0, 1, 1, 0, -1, 1, 1, -1, -1, -1, -1, 0, 1], [-1, 0, 1, -1, 1, -1, -1, 1, -1, 1, 0, 1, -1, 1, 1, 1, -1, 0, 0, -1, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, -1, 0, 1, 0, -1, -1, 0, -1, 0, 1, 0, 0, 1, -1, 1, -1, -1, 1, 1, 1], [0, -1, 1, 1, -1, 1, 0, -1, -1, -1, 1, - 1, 0, -1, 0, -1, 1, 1, -1, -1, 1, -1, 0, -1, 0, 0], [-1, -1, 1, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 1, -1, 1, 0, 1, 0, -1, 1, 1, -1, 0, 0, -1], [-1, -1, 1, 0, 1, 1, 0, -1, 1, -1, 0, -1, 1, 1, 0, 1, 1, 1, -1, 0, 0, 1, 0, 0, 1, -1], [0, 0, -1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 1, 1, -1, 0, 0, -1, 1, 0, 1, 0, -1, -1, 1]] it takes about 10 seconds on python3 and about 14 seconds using pypy3.5-5.10.1-linux_x86_64-portable _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue