Premature Optimization

A couple of weeks ago, I was sitting at lunch with a buddy of mine.  He was talking about all of this complicated programmatic caching of data that one of his customers was doing.  I remember stating that caching was only a good idea when there was a bottleneck.  I decided to drop the conversation because we were headed in an awkward direction.  You see, I have seen a lot of programmers try and implement caching because it is cool as oppossed to there being a real performance problem.  Alex Lowe refers to this as "Premature Optimization."  It reminded me of a situation I walked into a couple of years ago where a previous programmer was caching all kinds of data for this customer (different than previously mentioned).  The application is just dog slow.  I'm writing a new application for this customer (the one that has the slow application).  This new application is truly fast.  I remembered all this as I see that page refreshes occur in 1-2 seconds as oppossed to to 10-12 seconds on their other application.

BTW, I am not trying to toot my own horn.  I am merely saying that you should be aware and not spend lots ot time, effort, energy until you have the time to perform an analysis of your application and carefully analyze your bottlenecks. 

Beware of "Premature Optimization."

Really good article on the subject if you like things like Order of N2.

1 Comment

  • In my experience, the enemy isn't premature optimization, it's simply a poor job at optimization. Maybe it's premature because it wasn't properly planned...but more often than not I find it's a result of (a) people not really understanding how thigns work and (b) not providing concrete metrics to measure their efforts.

    Performance should be a first class non-functional requirement and, in my opinion, needs to be addressed upfront and throughout. That said, it needs to be well thought out and executed like all other development disciplines....

    I'm in a situation where I say "we should look at caching that"...and I'm told "well, we did that in the first version and look how slow it was". I have to constantly remind people that it isn't because it was cached that it's slow, it's because that it was poorly cached.

Comments have been disabled for this content.