GC is very expensive: am I doing something wrong?

Stefan Behnel stefan_ml at behnel.de
Tue Mar 23 06:05:36 EDT 2010


Paul Rubin, 23.03.2010 06:05:
> Antoine Pitrou writes:
>> "Orders of magnitude worse", in any case, sounds very exaggerated.
>
> The worst case can lose orders of magnitude if a lot of values hash
> to the same bucket.

While this is theoretically true, and it's good to be aware of this 
possibility, common string hash functions make it so rare in practice that 
a hash table will almost always outperform a trie for exact lookups. If it 
happens, it will either show up clearly enough in benchmarks or not be 
worth bothering.

Stefan




More information about the Python-list mailing list