I've been learning how to use Massif, a tool in valgrind for memory profiling. It quickly paid off!
I discovered that difftastic sometimes attempts to preallocate absurd amounts of memory.
A nice side effect of regular profiling: you know which parts of your code are cold.
For example, difftastic's display logic is very cold, so I can do additional linear scans to align content without perf worries!
Looking at performance of a new site I've written, and realised I'm slowly serving over 600 KiB of CSS!
I suppose the first set of profiling data is often surprising.