That sounds like a worthwhile optimization. FWIW, is this a bit simpler but sufficient?:
python -m timeit -n 2000 --setup "from uuid import uuid4; \ o = {uuid4().hex: i for i in range(10000)}" \ "dict(**o)" Is there a preferred tool to comprehensively measure the performance impact of a PR (with e.g. multiple contrived and average-case key/value sets)? On Wed, Sep 16, 2020, 7:07 PM Marco Sulla <marco.sulla.pyt...@gmail.com> 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%: > > python -m timeit -n 2000 --setup "from uuid import uuid4 ; o = > {str(uuid4()).replace('-', '') : str(uuid4()).replace('-', '') for i > in range(10000)}" "dict(**o)" > > 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)" > > Can I do a PR? > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/QWXD2D4SC6XHZLV3QA4TMGMI7Z7SAJ2R/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6RALUK5FUS25W4G5DM7ILZHFJOJTSPIM/ Code of Conduct: http://python.org/psf/codeofconduct/