WordCount performance
Walter Bright
newshound1 at digitalmars.com
Thu Mar 27 02:07:23 PDT 2008
Saaa wrote:
> What if you can't do b nor have the time to learn b and see that another
> compiler(language) runs faster without the need of b?
Because the insight gained by figuring out why one is faster than the
other will be very valuable to you in future projects. I know a lot of
programmers who made mistaken assumptions about why one program was
faster than another, assumptions that eventually wound up costing them
dearly.
A sampling:
1) used the wrong compiler switches
2) the 'faster' program was faster because it had a disastrous bug in it
3) thought that their benchmark was measuring loop performance, when it
was actually measuring the time spent in printf or malloc, rendering all
their conclusions about how to write fast loops false.
4) thought they'd discovered a unique fast algorithm, when what was
actually happening was the compiler optimizer had figured out how to
eliminate a redundant DIV instruction
5) the benchmark proving that language A runs faster than language B
turned out to be a result peculiar to that particular benchmark, and on
the real program the reverse was true
So, essentially, if you don't know *why* the benchmark produced the
results it did, you don't have enough information to draw any
conclusions about the language.
More information about the Digitalmars-d
mailing list