ptr vs ref performance?? (test case)

Tim Hollebeek tim@hollebeek.com
Thu Dec 14 18:17:00 GMT 2000


Rob Willis writes ...
> 
> Also, for these kind of performance tests - i compile with NO
> optimizations turned on.

Well, that's your problem right there.  Why do you expect the compiler
to generate the fastest compiled code if you don't *ASK* it to generate the
fastest code it can?

By turning no optimizations on, you indicate to the compiler that
speed is not a priority.  If the compiler gives you slow, but
accurate, simple, and easy to debug code that's what you asked for.
Why are you suprised?

If two equivalent pieces of code give the same results modulo speed
differences, why are you suprised?  You didn't ask for the fastest
possible code.  Heck, you didn't even ask for *fast* code.

Forget "Garbage in, garbage out".  

"Requirements not communicated, requirements not satisfied."  Running
benchmarks on unoptimized code simply demonstrates a very poor
understanding of benchmarks.


More information about the Gcc mailing list