This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients benspiller, serhiy.storchaka, vstinner
Date 2019-09-25.14:49:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569422972.35.0.489199177995.issue38278@roundup.psfhosted.org>
In-reply-to
Content
>python -m timeit -s "import collections; d=collections.defaultdict(lambda: None); d['abc']=123; " "x=d['XXX']"
5000000 loops, best of 5: 34.3 nsec per loop

This benchmark is not a fair comparison: the 'XXX' key is created at the first access. In short, this benchmark measure the performance of a dict lookup:

>python -m timeit -s "d={'abc':123}" "x=d['abc']"
5000000 loops, best of 5: 33 nsec per loop
History
Date User Action Args
2019-09-25 14:49:32vstinnersetrecipients: + vstinner, serhiy.storchaka, benspiller
2019-09-25 14:49:32vstinnersetmessageid: <1569422972.35.0.489199177995.issue38278@roundup.psfhosted.org>
2019-09-25 14:49:32vstinnerlinkissue38278 messages
2019-09-25 14:49:32vstinnercreate