Kirk's Blog
Java Performance
Services, Training, Seminars, Mentoring

lack of requirements responsible for pre-mature optimizations

posted Friday, 15 June 2007

Yesterday I presented my 1 day performance tuning seminar to a group in the Netherlands. They were an every engaging group and they sparked some very interesting discussions. One was regarding the old adage of pre-mature optimizations. The mantra is; make it work then make it fast. Though I do think that you do have to consider performance up front, it is advice that can't be ignored. I can cite numerous cases where people were trying to get code to run very fast before they actually had it functional. However I can also say that in just about every one of these cases the developer was lacking in requirements that would have helped him decide wether or not the optimization was premature or necessary.

For example, bubble sort is O(N^2) where as quicksort is O(nlogn). So obviously quicksort is much faster right? Well it depends, if you've got a small number of things doing a bubble sort will be quicker. The question is; do you have enough information in the form of requirements to know if the simple bubble sort is good enough for you're going to need to resort to the more complex quicksort. If you do have enough information then maybe coding up the quicksort isn't a premature optimization. If you don't have enough information then I'd have to say that it is. In either case it behooves you to isolate the sorting away from the rest of the application so that when you finally do get real requirements you can make it fast, if it isn't already fast enough.

tags:        




1. William Louth left...
Monday, 18 June 2007 8:10 pm :: http://blog.jinspired.com

It would be nice if the context behind the phrase "pre-mature optimizations is the root of evil" was cearly explained. Knowing the requirements is certainly important but this is only one part of the many activities that should be performed when applying software performance engineering (SPE) whether it is formal or not. In my experience effort is wasted (the evil) in any engineering activity when an engineers fails to derive a working model of the problem (situation).

I still cannot understand why SPE is not advocated more than it is. I can understand vendors (excluding myself) focusing on tools rather than process and models. But without a valid and verified performance model (and not just some tips or code snippets or adhoc tools) IT management staff will always expend more effort than is required in troubleshooting possible performance problems.

Recommended Link: http://www.perfeng.com

regards,

William


Course Schedule

Java Performance Training, Oslo Norway, October 8-11


Java Performance Tuning
Chania Crete, October 14-17

Speaking @

JavaZone, September 17-18

JAOO Aarhus, September 28 - Oct 3.

Calendar

««Aug 2008»»
SMTWTFS
      12
3456789
10111213141516
171819202122
23
24
252627282930
31

Performance Anti-Patterns

My Top Tags

                                       

Mailing List

My RSS Feeds