GCC Compiler Optimisation Levels

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 here.

Posted: October 7th, 2015 at 3:21 pm
Last Updated on: November 29th, 2017 at 6:13 am