Keith Watanabe * NET 2.0

Build First, Optimize Later
By: Keith Watanabe
Published On: 1-26-2008

My application at work met an interesting challenge when one part ran incredibly slow.  I never bothered benchmarking the thing initially and didn't consider the possibility of a large data set that would hit performance.  Well, I got hit by that large data set and my application would take far too long, doing loops around a data set of 14000+ items squared.  Naturally, this was AWFUL so I had to really consider how to beef up performance.  Mostly, eliminating the secondary loop, causing the redundant loop to occur. 

I ended up spending a good day banging my head over the problem.  After a good night's rest, I figured that I needed to start by removing any calls that would be performance intensive, especially iterative.  I found various database calls and some existing data elements that I could pass into the subroutine, thus improving speed somewhat.  But the main double loop was the killer problem.  Originally, I had written this one particular method to be reusable, in other words good economic, environment friendly programming.  However, sometimes it doesn't pay to be so economic at times if you don't see the overall impact a situation might have.

So I ended up re-writing a specialized routine for that piece of code that would pass in a previously established data set, kinda like a cache effect.  Space didn't matter in terms of memory usage as my application has limited users.  So doing a pass-by-value to the routine mattered little.  After re-integrating this piece of code into the application (with a few more performance enhancements), this little baby was soaring.  In fact, compared to the original application, it really boosted performance!  The performance boost was so great that my manager swore to rebuild his stuff after seeing the obvious difference in speed for the same data set.

Despite this anecdotal, what does my story have to do with the title?  The thing is that I wanted to at least get the application out there.  I'm on a deadline so I need to push things out fast.  I didn't have any assumptions when I first built it, therefore my initial purpose was to get it to work on some sample data.  More than that, I didn't understand enough the first time in trying to move it out.  So it was more important to demonstrate a workable demo rather than an error proof, solid, high octane application.  In other words, get it done and learn the first time what you're trying to figure out.  Then once you understand the problem better, improve on the answer of your problem.  That's the moral of this story.

AddThis Social Bookmark Button Sphere: Related Content

Trackbacks: (Trackback URL)

No Comments Posted Yet
September [October] November
Sun Mon Tue Wed Thu Fri Sat
28 29 30 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1