Brandt Bucher <brandtbuc...@gmail.com> added the comment:
Some quick benchmarks on a normal build with CPU isolation, tuned with pyperf. No PGO/LTO. $ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for _, _ in zip(i, i): pass' # Current master. ......................................... Mean +- std dev: 279 ms +- 11 ms $ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for _, _ in zip(i, i): pass' # With above fix. ......................................... Mean +- std dev: 369 ms +- 20 ms $ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for _, _ in zip(i, i): pass' # With above fix (no _PyTuple_MaybeUntrack). ......................................... Mean +- std dev: 284 ms +- 17 ms $ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for _, _ in zip(i, i): pass' # With no tuple reuse. ......................................... Mean +- std dev: 526 ms +- 51 ms Note that this example reuses the result tuple for *every* iteration. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42536> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com