Speed: bytecode vz C API calls

Aahz aahz at pythoncraft.com
Wed Dec 10 10:28:01 EST 2003


In article <tyf8yllyq51.fsf at pcepsft001.cern.ch>,
Jacek Generowicz  <jacek.generowicz at cern.ch> wrote:
>
>I tried something similar, namely inlining the 
>
>  try: return cache[args]
>  except KeyError: return cache.setdefault(args, callable(*args))
>      
>rather than using proxy. This gives a little over a factor of 3
>speedup, but it's not something I can use everywhere, as often the
>proxy is called inside map(...)

Why are you using map()?  Generally speaking, map() won't be any faster
than a for loop.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.




More information about the Python-list mailing list