bpo-31179: Make dict.copy() up to 5.5 times faster. by 1st1 · Pull Request #3067 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of an absolute number, why not using a ratio? 3 unused is may a lot if the dict contains 16 items, but what is the dict contains 2^16 items?

Would it make sense to use a ratio, tolerate a maximum of 10% unused entries? Or 1%?

What does impact performances of dict.set(): the absolute number or the ratio?

If it's the absolute number, just explain that above, something like: "each unused entry make dict.set() slower, so create a compacted dict for optimal performances".