[pypy-issue] Issue #1886: PyPy doesn't do basic loop-invariant optimizations (pypy/pypy)
issues-reply at bitbucket.org
Sun Oct 12 18:01:32 CEST 2014
New issue 1886: PyPy doesn't do basic loop-invariant optimizations
This code can be sped up about 25% by realizing that a[i] is constant in the inner loop.
I know threading potentially invalidates such optimizations but there are some options to work around that.
n = 10**4
a = [list(range(n))]*n
s = 0
for i in range(n):
#ai = a[i]
for j in range(n):
s += a[i][j]
More information about the pypy-issue