So, I've been slowing going back to using GNOME instead of using KDE-4. I do this flip flop every once in a while as I'm never truely satisfied by either. Now, GNOME works quite happily on my Gentoo/Linux machines, but this is not the case on my favoured NetBSD ones. Or rather, parts of GNOME don't work as they should, like the Evolution mail client.
Evolution suffers two problems on my NetBSD box. One, it takes over 5 minutes to load and two, once it has checked and downloaded mail from my server it closes without error. The 2nd problem is probably a programming error in Evolution or one of its many dependencies, but the first problem could be anywhere! Research led me to this possible soltuion. If you look closely, you'll find an old post by me in that thread fixing it with ld --as-needed on Gentoo/FreeBSD, but that isn't a real solution for NetBSD / pkgsrc users. Anyway, at first glance the patch on that thread makes perfect sense. So I came up with better patches (one for glib, one for Evolution) and it now loaded in under 3 seconds! All was well :)
Well, not entirely. Other applications started to show isses as a result. So at least we know we're in the right area. I then spent a few hours wading through the Evolution build chain and came to the conclusion I still hate autotools as it obscures everything but was no better off fixing it. But I did come up with a test case that opened an evolution library and searched for a symbol that did not exist. This should 30 seconds, which is far too long and is also probably what the poster of the FreeBSD patch did in the mail thread.
Cutting to the chase, the runtime linker on NetBSD was checking the same library for the same symbol over and over again. Going back to the FreeBSD linker, they have a patch which implements a negative cache which should solve this. But it doesn't, as it doesn't cache missed weak symbols. Luckily this is easy to rectify and you can find my patch here and an updated one after performance testing elsewhere here. Now Evolution loads in under 3 seconds and crashes right away - but that's an issue to fix another day :)