http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46186
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-10-26 14:59:18 UTC --- You get this kind of speedup if the compiler knows that the result of the loop is sum=(b*(b-1)-a*(a-1))/2 In which case the timing is meaningless (it is 0.000s on my laptop), so is the ratio with the execution of the loop. The basic question is: how much the user's ignorance should be repaired by the optimizer? (A colleague of mine told me that he once audited a CFD code and found that \int_a^b dx/x was evaluated numerically instead of using log(b)-log(a)!-)