Does the compiler do some major changes in release profile?

134 points sup3rar

So I made some tests to see how fast different programming languages are. I made a program in rust that sums all numbers from 1 to n in a for loop and returns it.

In dev mode it took 1.5 seconds, but in release mode it took 0s. Does the compiler analyze the code and use the formula n(n+1) / 2 ?