Performance is a subject that seems straight forward, but can get controversial easily. After all, we all want our software to be fast, right?. But there is a catch, performance comes often at a high price: code that is difficult to understand, change or extend.
I remember, many years ago, writing code with a friend. The routine in question was rendering a graphic to the screen, basically copying a piece of data from the RAM to the video card's memory. This was being done in assembly, because every cpu tick was to be optimized. To make a long story short, we even ended up 'unrolling loops'. This means to change something like this:
for f = 1 to 3 {
do something;
}
to
do something;
do something;
do something;
It would use more memory, but it would be faster than the loop. Now, imagine if the loop was longer that three... and if you start reading this code. It'd be more …
[Read more]