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 vstinner
Date 2016-01-09.09:53:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452333186.64.0.00860839584486.issue26058@psf.upfronthosting.co.za>
In-reply-to
Content
Using timeit to microbenchmark dict operations (constructor, __setitem__, __delitem__, clear), I get exactly the same performance or even better performance (???) with the patch.

./python -m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del d[2]; d.clear()'

Original: 318 ns
Patched: 318 ns

./python -m timeit 'd={i:i for i in range(2**16)}' 'for i in range(2**16): d[i]=i-1' 'for i in range(2**16): d[i]=i+1' 'for i in range(2**15): del d[i]' 'd.clear()'

Original: 19.9 ms
Patched: 18.9 ms (5% faster)
History
Date User Action Args
2016-01-09 09:53:06vstinnersetrecipients: + vstinner
2016-01-09 09:53:06vstinnersetmessageid: <1452333186.64.0.00860839584486.issue26058@psf.upfronthosting.co.za>
2016-01-09 09:53:06vstinnerlinkissue26058 messages
2016-01-09 09:53:06vstinnercreate