Array indexing vs. pointers...

Doug Gwyn gwyn at smoke.ARPA
Mon Oct 10 12:42:10 AEST 1988


In article <1988Oct9.033134.15553 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <8646 at smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>>>As Knuth once said, approximately, "in no other branch of engineering is an
>>>easily-obtained 10% improvement in performance viewed with scorn".
>>That isn't even a correct obervation, let alone relevant.
>While I'm not really in Knuth's camp on this general issue, I think I must
>defend his comment.  There really are people -- too many of them -- who
>consider a 10% performance improvement to be so insignificant that it's
>not a valid argument in a debate.  These are generally people who have
>never done performance-critical programming.

There are times when it matters and times when it doesn't.
The latter dominate.
For example, most time in a highly interactive system is spent
waiting for the human to think.  So long as the system response
is fast enough, additional improvement is wasted.  (If the
response is NOT fast enough, then improvement is justifiable.)
Another example is spending a lot of developer time on wringing
out an additional 10% of code speed by machine-specific
micro-level tweaks that make originally simple code hard to
maintain, when a much greater improvement would be to simply
switch to more capable hardware.  This is particularly bad
when there are far more problems needing attention than there
are qualified problem solvers, as is usually the case.

I will agree that UNNECESSARY inefficiency should be avoided.
A few percent lost in several places in the code can produce
a significant loss for the overall system.  But I don't think
that "efficiency" should be the software engineer's main
concern, just one of many factors that have to be balanced.



More information about the Comp.lang.c mailing list