On Thu, Sep 17, 2020 at 8:03 AM Marco Sulla <[email protected]> wrote: > > Well, it seems ok now: > https://github.com/python/cpython/compare/master...Marco-Sulla:master > > I've done a quick speed test and speedup is quite high for a creation > using keywods or a dict with "holes": about 30%:
30% on microbenchmark is not quite high. For example, I have optimized "copy dict with holes" but I rejected my PR because I am not sure performance / maintenance cost ratio is good enough. https://bugs.python.org/issue41431#msg374556 https://github.com/python/cpython/pull/21669 > > python -m timeit -n 2000 --setup "from uuid import uuid4 ; o = > {str(uuid4()).replace('-', '') : str(uuid4()).replace('-', '') for i > in range(10000)}" "dict(**o)" > I don't think this use case is worth to optimize, because `dict(o)` or `o.copy()` is Pythonic. > python -m timeit -n 10000 --setup "from uuid import uuid4 ; o = > {str(uuid4()).replace('-', '') : str(uuid4()).replace('-', '') for i > in range(10000)} ; it = iter(o) ; key0 = next(it) ; o.pop(key0)" > "dict(o)" > It is controversial. If the optimization is very simple, it might be worth enough. Regards, -- Inada Naoki <[email protected]> _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/LE6RLLKF4QRRA4P2EXUK5MXVH6X4CSUZ/ Code of Conduct: http://python.org/psf/codeofconduct/
