Tibor's Musings

Python Exception Handling Overhead

In a previous blog post, I've estimated Python OO method call overhead to be about 10% over function calls. What about exception handling?

Here the situation differs. Exceptions are so pervasive in Python core language that handling exceptional cases of your code via adding more exceptions do not add much …

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 …

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?

By measuring performance of functional redefinition vs performance of class method calls.

One can find out that the overhead of using the OO method calls over functional calls seems …

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.

Basic Psyco usage is very simple: just do:

import psyco

and later:


for each function/class you want to speed up …

Average Style of Programming

A danger of machinable software engineering factory: average style of programming.

The problem with software engineering methodologies is that they often promote a kind of "average" style of programming, often leading to mediocrity, or even worse, unnecessary overbloatedness. My favourite quote illustrating this problem comes from an excellent book by …