Here I compile an input program with -O2 optimization level (with gcc 4.8.4) and measure the execution time:
gcc -O2 -c test.c -o obj.o TIMEFORMAT=\'%3R\' &a
There is 2 good optimization that should be know: