On Thu, Oct 14, 2021 at 08:36:37AM -0000, Jeremiah Vivian wrote:
So I implemented these functions as operators in a downloaded source of CPython... the differences are insane! (Sorry if this produces nested quotes)
import timeit
# d + 1 vs list(d.values())[0]: 2133x speedup
d is a dict. You are trying to add 1 to a dict. Why?
`list(d.values())[0]` is a terrible way to extract a single value from a dict. Of course it is going to be slow.