GCC Compiler Optimisation Levels

Article by:
Date Published:
Last Modified:

Fancy Optimisations

One aspect of GCC optimisation that still amazes me is it's ability to convert specific repetitive operations into highly-efficient mathematical sequence equations.

One example is that GCC can convert an function in where you sum all the integers up to the number specified as an input variable using a for loop, into the equation x * (x + 1) / 2.

This is covered in more detail at http://blog.xebia.com/gcc-compiler-optimizations-dissection-of-a-benchmark/.


Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content


comments powered by Disqus