[pypy-issue] Issue #2351: Creating and overwriting tuples 4x slower on PyPy (pypy/pypy)

Eric Astor issues-reply at bitbucket.org
Fri Jul 22 01:51:01 EDT 2016


New issue 2351: Creating and overwriting tuples 4x slower on PyPy
https://bitbucket.org/pypy/pypy/issues/2351/creating-and-overwriting-tuples-4x-slower

Eric Astor:

Using PyPy 5.3.1 (on Windows):

```
#!bash

pypy -m timeit -n 10000 -s "a = range(10000)" "tuple(a)"
```
takes (on my system) ~67 usec per loop, while
```
#!bash

python27 -m timeit -n 10000 -s "a = range(10000)" "tuple(a)"
```
takes only ~25.5 usec per loop.

Furthermore, assigning the tuple to a variable
```
#!bash

pypy -m timeit -n 10000 -s "a = range(10000)" "x = tuple(a)"
```
now takes ~109 usec per loop, but does not impact CPython's performance at all.

However, if we clear the variable after each assignment, performance recovers:
```
#!bash

pypy -m timeit -n 10000 -s "a = range(10000)" "x = tuple(a); del x"
```
returns to taking ~67 usec per loop.




More information about the pypy-issue mailing list