[Python-Dev] exception too expensive?

Raymond Hettinger raymond.hettinger at verizon.net
Sat Jul 8 23:37:38 CEST 2006


> i thought avoiding a second dict lookup should be faster, but it turned out
> to be completely wrong.

Unless you have an expensive hash function, it is almost never worth it to try 
to avoid a second lookup.  Because of memory cache effects, the second lookup is 
dirt cheap (a cache miss is about as expensive as a floating point division). 
See dictnotes.txt for a few thoughts on the subject.


Raymond



More information about the Python-Dev mailing list