[New-bugs-announce] [issue28638] Creating namedtuple is too slow
INADA Naoki
report at bugs.python.org
Mon Nov 7 23:07:24 EST 2016
New submission from INADA Naoki:
I surprised how functools make import time slower.
And I find namedtuple makes it slower.
When I replaced
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
this line with `_CachedInfo._source`:
(before)
$ ~/local/py37/bin/python3 -m perf timeit -s 'import importlib, functools' -- 'importlib.reload(functools)'
.....................
Median +- std dev: 1.21 ms +- 0.01 ms
(replaced)
$ ~/local/py37/bin/python3 -m perf timeit -s 'import importlib, functools' -- 'importlib.reload(functools)'
.....................
Median +- std dev: 615 us +- 12 us
----------
messages: 280277
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Creating namedtuple is too slow
type: performance
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28638>
_______________________________________
More information about the New-bugs-announce
mailing list