Optimising program code for maximum performance is often considered to be some sort of black art. Also, quite a number of programmers believe in micro-optimisations that rarely ever improve program execution time, but nearly always introduce subtle bugs or obfuscate the code, or both.

In the following we will have a look at optimisation possibilities that help cut down execution time considerably while still keeping the code clear and easily maintainable.