Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
First make it right. Then make it fast.

To subscribe to my feed, add the following Url:  http://feeds.feedburner.com/jeffreypalermo.

I spent the first part of my career on the side of the fence where I want to make it fast first.  In fact, I wanted to keep it fast all the way through.

I'm talking about software.  Performance optimization.  Speed. 

There was a time when every time I concatenated a string I weighed the theoretical pros and cons of using the plus operator vs StringBuilder vs. string.Format().  I even measured differences.  I've now come to the point where I realize that PDD (pain-driven development) is the real decision-maker.  It's no longer worth my time to think about what concatenation method might be faster.  Compared to a single database call, the speed different is irrelevant.

Point:  A well-designed application can be tuned at any conceivable place after it's working correctly.  An application that has "performance optimizations" coded into it from the start has less flexibility for the inevitable bottleneck that surfaces unexpectedly.

Point:  I will not guess at what part of my code will be a bottleneck unless I have past experience in the exact same scenario.  Rather, I will lead the team to create correct software that _appears_ to be fast enough throughout the project.  At an agreed-upon time we'll profile (with the appropriate tools - yes, I mean _measure_) the application and find any bottlenecks that are not acceptable for production.  Then, with real data in hand, we'll tune exactly the right parts of the application.  We will not guess before measuring.  After measuring, guessing is not necessary.

Point:  First make it right.  Then make it fast.

In general, out of process calls are performance bottlenecks, not in-process logic.  Either way, measuring tells the truth, not guessing.


Posted 02-11-2008 1:58 PM by Jeffrey Palermo

[Advertisement]

Comments

Peter Ritchie wrote re: First make it right. Then make it fast.
on 02-11-2008 3:12 PM

Picking the a known faster algorithm is not premature optimization.

Jeffrey Palermo wrote re: First make it right. Then make it fast.
on 02-11-2008 3:19 PM

@Peter,

You are correct.  Picking a known faster algorithm is not premature optimization.

Ayende Rahien wrote re: First make it right. Then make it fast.
on 02-11-2008 4:58 PM

About the only time that I think performance when I am writing code is for out of process calls (that include DB queries).

I tend to try to minimize those up front, usually by designing the interfaces between the two appropriately.

Other than that, whatever works, and optimize later.

Kevin Radcliffe wrote re: First make it right. Then make it fast.
on 02-11-2008 4:59 PM

My own experience with this has been very similar.

I've seen many situations where the profiler ended up making a fool of me (THAT was the bottleneck!?).

My own optimizations usually made negligible performance difference and often caused some loss of readability.

I'm still working out what is "right", but at least the readability and maintainability of my code has improved.

vikram wrote re: First make it right. Then make it fast.
on 02-12-2008 1:59 AM

Yes important to build a correct system first and look at performance later, But performance should not be negelected later on......

Unknown wrote re: First make it right. Then make it fast.
on 02-12-2008 6:45 AM

Make it correct, make it clear, make it concise, make it fast.  In that order.

Jeff Handley wrote re: First make it right. Then make it fast.
on 02-12-2008 7:42 AM

I agree completely.  The PM on my current project has a good philosophy:

1. Make it work

2. Make it stable

3. Make it fast

4. Make it pretty

Eric wrote re: First make it right. Then make it fast.
on 02-14-2008 8:41 AM

Post like this make me wonder about the talent in the market place. First off, there is no one rule for doing any one thing first. Of course you want to do it right first, if you didn't why bother in the first place. We are the only industry that the workers analyze ever single thing they do and try to come up with one answer. Good thing the guys working on my house didn't spend the time analyzing what they should or should not do first.

Sanjay wrote re: First make it right. Then make it fast.
on 02-14-2008 9:54 AM

Totally agree, and specifically with the overall opinion and especially with Jeff's order of priorities.  I actually posted a similar thought on my blog quite some time ago (geekswithblogs.net/.../84903.aspx)  and met with some resistance.

Kris Brixon wrote re: First make it right. Then make it fast.
on 02-14-2008 2:44 PM

@Eric

The guys working on your house DID analyze what should be done first. They just did it on previous houses and learned from previous contractors. I am sure they did not put up the drywall before the wiring or install the roof before the foundation.

I have heard in the past:

1. Make it Work

2. Make it work Right

3. Make it work Fast

Interesting Links of the week(Feb 15th 2008) « Rambling wrote Interesting Links of the week(Feb 15th 2008) « Rambling
on 02-15-2008 8:16 AM

Pingback from  Interesting Links of the week(Feb 15th 2008) « Rambling