Wandering Thoughts archives

2006-04-04

Why I don't like resorting to caching

One of my little twitches is that I really don't like putting caching in my programs. It's not because cache invalidation is hard, although it is. It's because resorting to caching is an admission of defeat: it's admitting that I can't make the actual code go fast enough.

In other words, I've failed to write code that's fast enough. I don't think any programmer likes to fail; certainly I don't. I don't like it even when it's not entirely my fault; for example, when the underlying language features and libraries aren't fast enough.

(Of course, sometimes the problem is intrinsically slow no matter how much you optimize. I don't feel bad about those; that's just running into a physical limitation.)

Caching is a compromise; it's a tradeoff of a quick fix against the right fix, however much effort the right fix may take. Of course, that's the perfection trap singing its siren song to me.

The net result is that adding caching too often feels like slathering a bright coat of paint on a rickety house and hoping that no one notices. Doing that sort of thing always leaves me feeling grumpy and dissatisfied.

(And of course one has to measure the overhead of caching, cache checking, and cache invalidation, just to make sure that the cache is actually speeding things up. Benchmarking: enough tedium for the whole family.)

programming/DislikingCaching written at 03:48:52; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.