i dont know how i can possibly explain it any more simply than the gcc man pages.. but anyways..
-O0 = no optimisation
-O1 = perform optimisations that will not increace compile time significantly
-O2 = perform optimisations that will not increace binary size significantly
-O3 = apply all optimisations
-Os = optimise binary size, (almost as optimised as -O2)
rule of thumb....
if compile time is an issue, use -O1
if binary file size is an issue, but compile time is not, use -O2
if time, nor binary file size is an issue, use -O3
if file size IS an issue, use -Os
if you get seg faults, or have bad hardware, recompile with a lover optimisation.