[fpc-pascal] Optimization levels

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jun 5 08:41:55 CEST 2007


On 5 jun 2007, at 03:49, Francisco Reyes wrote:

> Looking at the compiler parameters I see:
>
> -Og        generate smaller code
> -OG        generate faster code (default)
>
> Is the difference in speed/size significant?

Usually not.

> -O1        level 1 optimizations (quick optimizations)
> -O2        level 2 optimizations (-O1 + slower optimizations)
> -O3        level 3 optimizations (-O2 repeatedly, max 5 times)
>
> Is it safe to use any of those?

Yes.

> When, if at all, it could be a bad idea to use them?

When you want to debug the result, or when you want a quick compile  
(higher optimization levels take more time).

> -Op<x>     target processor:
> -Op1       set target processor to 386/486
> -Op2       set target processor to Pentium/PentiumMMX (tm)
> -Op3       set target processor to PPro/PII/c6x86/K6 (tm)
> -Op4       set target processor to Pentium 4 (tm)
> -Op5       set target processor to Pentium M (tm)
>
> Which of those would be 586 and 686 type CPUs?
> Specially AMD cpus.
>
> Like.
> CPU: AMD Duron(tm) Processor (902.05-MHz 686-class CPU)

-Op3. It will make very little difference though.


Jonas



More information about the fpc-pascal mailing list