New issue 1776: Creating instances of a namedtuple is inexplicably very slow
https://bitbucket.org/pypy/pypy/issue/1776/creating-instances-of-a-namedtuple-is

Alex Gaynor:

Compare:

```
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = (1, 2)"
1000000000 loops, best of 3: 0.000867 usec per loop
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = (1, 2)"
1000000000 loops, best of 3: 0.000867 usec per loop
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = (1, 2)"
1000000000 loops, best of 3: 0.00087 usec per loop
$
$
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = pos(1, 2)"
100000000 loops, best of 3: 0.026 usec per loop
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = pos(1, 2)"
100000000 loops, best of 3: 0.0264 usec per loop
$ pypy -mtimeit -s "from collections import namedtuple; pos = namedtuple('pos', 
['x', 'y'])" "p = pos(1, 2)"
100000000 loops, best of 3: 0.0268 usec per loop
```

Looking at the traces, I don't see anything that explains the difference in the 
`jit-log-opt-loop` section, however looking at `jit-summary`, I see that the 
namedtuple version compiles many many more bridges, we should figure out why.


_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to