System programming in D (Was: The God Language)

Peter Alexander peter.alexander.au at gmail.com
Fri Dec 30 03:36:31 PST 2011


On 30/12/11 9:13 AM, Walter Bright wrote:
> And if one really wants to force an inline, one can do things like the C
> memcpy using the preprocessor, or string mixins in D, or even cut&paste.
> If you need to do that in more than a couple places in the code,
> something else is wrong (that old saw about only a tiny percentage of
> the code being a bottleneck is true).

When you are writing really performance sensitive code, that old adage 
is certainly *not* true.

It only happens in practice when you don't care that much about 
performance. When you really care, you've already optimised those hot 
spots, so what you end up with is a completely flat profile: no part of 
the program is the bottleneck, but the whole thing is.

At that point, you're likely suffering a death from a thousand cuts: no 
single part of your program is the bottleneck; your poor performance is 
just the sum total of a bunch of small performance penalties here and there.

A perfect example of this is vector operations. Games use vector 
operations all over the place, so their impact on performance is spread 
out over the entire program. You'll never see a dot product or vector 
addition routine at the top of a profile chart, but it will certainly 
affect performance!


More information about the Digitalmars-d mailing list