You are here


Sometimes it doesn't pay off to be smart and write the best possible code. Good code can be slow and bad code can be fast.

The Treectrl widget which is a core part of the Coccinella came with a 2.2 release a couple of months ago, and this included support for the much awaited tags. Each item can have a list of more or less arbitrary tags instead of being referenced with just a number, which may change if items are recreated. Previously I just kept an array that mapped tag to item number.

So I rewrote all the code to use tags. Fine! Except for one thing. Just did some benchmarking using the disco tree code and found it to be more than two times slower than my old code. Since this is critical due to large conference room listings, I had to switch back to my old code. The roster tree is also time critical but the treectrl code is different than the disco tree code. I dare not to use any benchmarking yet but I must keep this in mind. Luckily the code is fairly well abstracted and the size is just about 60 lines of code.

The bottom line is: if doing changes in time critical parts, do prepare a benchmark test before-and-after.