Strange optimization results
Brian Budge
brian.budge@gmail.com
Mon Apr 11 01:07:00 GMT 2011
2011/4/10 Jonathan Wakely <jwakely.gcc@gmail.com>:
> Did you run the tests more than once and average the results? Your
> test code has no timing measurements in it, what are you measuring?
> The entire time for the executable to run? That includes time for the
> OS to create and run a new process, and will depend how busy the
> system is, so could have very little to do with the code in the
> executable.
>
I would also add, having made many similar benchmarks with gcc, that
this test is probably too trivial for meaningful results. I wouldn't
be surprised at all if with any level of optimization, the compiler
can determine that the loop doesn't actually even have to be run more
than once, since the result is the same every time through.
Brian
More information about the Gcc-help
mailing list