Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

Optimization levels

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Francisco Reyes

Looking at the compiler parameters I see:

-Og generate smaller code
-OG generate faster code (default)

Is the difference in speed/size significant?

-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?
When, if at all, it could be a bad idea to use them?

-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)

Jonas Maebe
to Francisco Reyes
Francisco Reyes wrote 6 lines
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.

Show quoted text 5 lines
-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).

Show quoted text 12 lines
-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