Hi all and question.

congchualon

New member
Hi forum, im a new so i want to say hello.

And second does anyone have a description and suggested usage for the optimize options, such as:

Fast, Faster, Fastest
LTO
Pure Code
Debug
Smallest code

etc.

I tend to use FASTEST + pure code and LTO option as my code runs the fastest with these options, but don't like blind decisions.

Thanks in advance!
 
Use File > Preferences to turn on verbose info while compiling.

Then Arduino will show you the exact gcc commands it is using to compile your program. Most of these just change the -O optimization level. Some also add C library specs, for the reduced size printf. Arduino's console panel supports copy to clipboard, so you can copy compiler commands from different tests into a text editor to more easily see what each option changed.

If you *really* want to dig into the details, you'll probably need to read the gcc documentation which can be found online. It's a deep rabbit hold of compiler optimization details.
 
Hello and welcome!

Absolutely what Paul said, of course.

Just a quick glimpse:

Fast, Faster, Fastest

Different GCC optimizations levels (think -O1, -O2, -O3)


Turns on Link-time Optimizations.
GCC produces additional informations to optimize stuff across the various modules which compose the final executable.
Beware: LTO sometimes BREAKS the resulting executable, which may run oddlly or not at all.
For example, I got issues with a few OLED libraries.

Pure Code

This is is not available on Teensy LC (can't remember about T4.x, can't check at the moment).
It forces the compiler not to store read-only data in the "code" section (so it will put it in the "data" section instead).
It should strengthen security; not sure if it helps performances too.


For Teensy+Arduino environment, I don't think it's useful. We don't have an integrated step debugger (unfortunately).

Smallest code

The compiler strives to produce the smallest possible code, even at the cost of reducing speed optimizations (i.e. loops unrolling).
It helps when you have a Teensy model with smaller program memory (for example the LC) and/or a large program.
 
Back
Top