Author jdemeyer
Recipients jdemeyer, methane, skrah, vstinner
Date 2019-07-03.10:53:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562151234.72.0.606884223675.issue37483@roundup.psfhosted.org>
In-reply-to
Content
> Is there any benchmark showing if it's faster

Here is one example:

class D(dict):
    def __missing__(self, key):
        return None
d = D()

and now benchmark d[0]

**before**: Mean +- std dev: 173 ns +- 1 ns
**after**: Mean +- std dev: 162 ns +- 1 ns

To be precise, I ran: ./python -m perf timeit --duplicate 200 -s 'class D(dict):' -s ' def __missing__(self, key):' -s '  return None' -s 'd = D()' 'd[0]'
History
Date User Action Args
2019-07-03 10:53:54jdemeyersetrecipients: + jdemeyer, vstinner, methane, skrah
2019-07-03 10:53:54jdemeyersetmessageid: <1562151234.72.0.606884223675.issue37483@roundup.psfhosted.org>
2019-07-03 10:53:54jdemeyerlinkissue37483 messages
2019-07-03 10:53:54jdemeyercreate