2 ms·
Somewhat related, hash() returns a result % sys.hash_info.modulus, so if you build a set or a dict with keys multiple of sys.hash_info.modulus, you run into qua
by vhcr 2y ago
Somewhat related, hash() returns a result % sys.hash_info.modulus, so if you build a set or a dict with keys multiple of sys.hash_info.modulus, you run into quadratic behavior.
>>> {i * sys.hash_info.modulus for i in range(5000)}
0.40s
>>> {i * sys.hash_info.modulus for i in range(50000)}
29.34s
>>> {i for i in range(50000)}
0.06s