I'm finally doing some serious optimisation of ikiwiki tonight. It had been feeling a bit slow.

So far with one optimisation (making it into a two-pass compiler) I've sped it up about 8x in some cases, though it's probably more like 2x-4x in the general case of rebuilding a wiki from scratch. Incremental builds are also sped up somewhat, though generally much less.

Another optimisation changes backlinks calculation from O(N3) to O(N2) on the number of pages in the wiki. Of course N2 still isn't very good, but this is still a serious improvement. Especially when you have thousands of pages.

Rebuilding my personal wiki with these optimisations, it builds 9 times faster than before, now taking just 1 minute. Ikiwiki's own wiki rebuilds in 7 seconds instead of 34.

Stunning!