4 ms·
Python's set is ridiculously optimized (since it's based on the dictionary which is used bloody everywhere). A few months ago when the "hashtables in functiona
by kingkilr 17y ago
Python's set is ridiculously optimized (since it's based on the dictionary which is used bloody everywhere). A few months ago when the "hashtables in functional languages" benchmarks were going around I implemented the "stick the numbers 1 through a million in a hash table and then get 1 out" thing in both Python and C++. Python was faster with no -O provided, and a little slower with -O3, but massively faster if you added psyco to Python.