This evening, my wife asked me to take care of a load of laundry. Specifically, she asked me to take out all of the non-wrinkled clothes and fold them, while the rest of the load de-wrinkled in our wonderfully advanced, de-wrinkling dryer. I looked at her like she was crazy, and told her what I would do instead was just de-wrinkle all of it and then fold the load later.
My thinking was obvious: delay the unpleasentness of handling the laundry until hopefully I would not have to do it, or at least until after dinner.
Her thinking was more practical: do what can be done now, while the rest is being dewrinkled, and then I would have less to worry about when she leaves me with the kids after dinner.
In the end, I chose the only sane option of the two: I did it her way. The reason (besides the obvious: I was not prepared to die over laundry), is that she also imparted a technique that made sense: take all of the laundry out of the dryer, spread it out, and then put all the things that need to go back in the dryer back in the dryer. Simple. My initial thought when I looked at her like she was crazy was that she wanted me to dig through the clothes while still in the dryer and get out all the things that were not wrinkly. Obviously a more painful approach and thus why I optimized it out of the loop entirely.
Pondering the results
While doing as I was told, I pondered wether my initial approach (just letting it all de-wrinkle) was the more performant approach, as now I was moving the laundry from the dryer to the sorting area and partially back to the dryer, instead of pressing two buttons and then getting back to playing with my kids for a while and then dealing with it all at once.
Well, as usual with performance, it depends. See, if I did it her way I would spend a little more time on the laundry (processing time) but I would be done sooner (latency). My solution only saved time in the processing sense: I would not move the laundry around as much, and was ultimately the simplist approach. Which is the right approach (ignoring for the moment the whole death thing)?
I experienced much the same question at work today. Do we worry about performance first or do we strive for a simpler processing model and then worry about performance? If you are like most techies I know, you say performance. Why? Because it is the harder problem, at least on the surface. Simplicity is subjective, and performance is not, when applied in a scientific manner. In practice performance is usually just as subjective. I hear people say all the time that to write fast Java code you need to use StringBuffer. And thats it. To me, simplcity should always be the primary goal against the given set of requirements. If performance is a requirement, then it gets added to the equation. If it isn’t then we only worry about it when it becomes apparent that it is a problem.
performance = f(simplicity, nature of the processing)
I believe strongly that performance is a function of the simplicity of the system, and the nature of the processing. The simpler the system, the more performant it usually is. I say usually because in this case I am talking about the Einstienian view of simplicity: “Make it as simple as possible, but no simpler”. One can overly simplify the system and cause it to do too much of everything as a result. It is a fine line to walk.
Its not personal, it’s just business
Really, when it comes down to it, if the business requires a certain level of perfornance, than that is what matters. In my case tonight my wife had certain expectations (business reasons) that needed to be met if I was to be saved. At work today it was not quite as clear cut. Yes performance matters, but more than a simple, easily maintainable design? That is not an easy choice to make. It is even more difficult when you add multiple people, each with their own perspective(s) to the mix. My wife and I had different perspectives, which gave us different ways to solve the problem. She had an approach that was simpler than my painful approach, and while slightly more costly than my initial approach in processing time, was effective and got her what she wanted. Sometimes even when the simplest is not “too simple”, there is a compromise that satisfies the perspectives better.