Tibor's Musings

Python Memoisation

If the profiling shows that you call some function a lot of times for the same arguments, then memoise it. The canonical example is memoising the intermediate results of the Fibonacci recursive calculator, presented below. But beware: if you do memoise, better make sure that you don't eat up the full memory! Memoising is a classic speed versus memory dilemma.

Python Method Call Overhead

Python function calls are expensive. Python object oriented method calls are even more expensive. How can we estimate method call overhead?

Python Psyco

A simple (and sometimes very efficient) way to speed up your Python programs is via the Psyco module. But beware, Psyco only runs on 32-bit OSes.