[issue28638] Optimize namedtuple creation

Serhiy Storchaka report at bugs.python.org
Sun Sep 10 03:46:18 EDT 2017


Serhiy Storchaka added the comment:

Microbenchmark for caching docstrings:

$ ./python -m perf timeit -s "from collections import namedtuple; names = ['field%d' % i for i in range(1000)]" -- "namedtuple('A', names)"

With sys.intern(): Mean +- std dev: 3.57 ms +- 0.05 ms
With Python-level caching: Mean +- std dev: 3.25 ms +- 0.05 ms

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue28638>
_______________________________________


More information about the Python-bugs-list mailing list