Project - Stage 3 - Optimization - Compiler Options -O3 - aarchie

**AS MENTIONED IN THE POST ABOUT A SAMPLING RATE OF PERF IN THE PREVIOUS POST, I RAN INTO THE SAME PROBLEM ON AARCHIE.
FOR THIS REASON, I'LL UPDATE MY BENCHMARK WITH USING -F 97 OPTION ON PERF AND WILL PERFORM ALL THE OPTIMIZATION TESTS USING THIS OPTION**

As a first approach to optimization of the program, I will look into and test how much differences can be made with just using compiler options.

Out of the box the program is built with following compiler options:
-O2
-g
-Wall

What do these options mean?
Lists are found at gcc online docs

-O2: turns on all optimization flags specified by -O. It also turns on the extra flags.
-g: produce debugging information in the operating system's native format.
-Wall: enables all the warnings about constructions that some users consider questionable, and that are easy to avoid.
-Winline: warn if a function that is declared as inline cannot be inlined.


So, from the list we can see that only optimization option used is -O2.
GCC has 4 optimization levels, -O0, -O1, -O2, -O3, -Os.

Difference between -O2 and -O3
-O3 is higher optimization option than -O2. -O3 turns on more optimization flags on top of what was turned on by -O2.
The differences of the flags turned on by the two can be found here.

== Original CFLAGS ==
-Wall -Winline -O2 -g


== New CFLAGS ==
CFLAGS=-Wall -Winline -O3 -g

==RESULTS==

sample.txt


largeImage.jpg



Difference between Original

I used average time of 5 tests of each versions for the difference calculation.

The -O3 showed, though not by much, some improvement in the performance. Compression of random text file was 0.73% faster and compression of large image file was 0.34% faster.
Next step is to test if adding more optimization flags, that are not turned on by -O3, will further improve the performance.

Comments