Re: What's more important optimisations or debugging?
- From: "Wilco Dijkstra" <Wilco_dot_Dijkstra@xxxxxxxxxxxx>
- Date: Thu, 31 May 2007 21:03:20 GMT
"Paul Taylor" <paul_ng_pls_rem@xxxxxxxxxxxxx> wrote in message
news:pan.2007.05.31.16.35.41.638016@xxxxxxxxxxxxxxxx
On Thu, 31 May 2007 12:00:56 +0000, Wilco Dijkstra wrote:
Remember Knuth's golden rules about optimisation:
1. Don't do it.
2. (For experts only) Don't do it yet.
I don't agree with this. For small programs it is easy to implement an
efficient algorithm immediately rather than start with an inefficient one.
It's hard to improve badly written code, so rewriting it from scratch
would be better than trying to fix it.
For large programs it is essential that you select the most optimal
architecture and algorithms beforehand, as it is usually impossible to
change them later. The bottlenecks are typically caused by badly
designed interfaces adding too much overhead.
In my experience well designed code is both efficient and easy to
understand, so it wouldn't need optimization (apart from fine tuning).
In other words, if you *need* to optimise an application, you got it wrong.
What you are describing is what I would image all experienced software
engineers do. But then what do you do if performance isn't good enough?
i.e. wrt the design - you got it wrong. I suspect that's when Knuth's
golden rules kick in. I could of course be barking up the wrong tree -
I haven't read Knuth.
The above rules refer to premature optimization, which is allowing efficiency
considerations affect the design (in a presumed negative way). A similar
quote is "premature optimization is the root of all evil". Neither is Knuth's,
the golden rules are Jackson's, the other is Hoare.
However my point is that you precisely have to design for efficiency as it is
not something you can add at a later stage. And efficiency matters a lot in
the embedded world.
Back to your question of what to do when things go wrong. At that point
you've got no choice but to optimize in every possible way. I "optimized"
a 600K line application by compiling it with the best compiler money can
buy and carefully choosing the optimal set of compilation options. There is
not much else one can do once all hotspots have been removed.
Wilco
.
- References:
- What's more important optimisations or debugging?
- From: rhapgood
- Re: What's more important optimisations or debugging?
- From: Dave Hansen
- Re: What's more important optimisations or debugging?
- From: David Brown
- Re: What's more important optimisations or debugging?
- From: Wilco Dijkstra
- Re: What's more important optimisations or debugging?
- From: Paul Taylor
- What's more important optimisations or debugging?
- Prev by Date: Re: MPLAB C 30 Student Edition C-Compiler optimization level 1
- Next by Date: big problem with Philips PDS51 emulator
- Previous by thread: Re: What's more important optimisations or debugging?
- Next by thread: Re: What's more important optimisations or debugging?
- Index(es):
Relevant Pages
|