How to Use Arduino Compiler Optimizations to Produce Faster and Smaller Code

preview_player
Показать описание
When you become “better at Arduino” and sketches grow bigger or get more demanding, you may run into problems related to execution speed or program size or even both.

Before deciding to change the board, first a thorough code inspection is done to see if it can’t be optimized in some way so that it will fit or run fast enough.

But there are also compiler optimization options that you can try to see if they can help you out quickly. These options are not accessible through the IDE, but that doesn’t mean that they cannot be used at all.

This video shows how to use them and what their performance is.

Рекомендации по теме
Комментарии
Автор

Thanks for the vifdeo. It's really helpful.

TT-itgg
Автор

Goed verhaal en duidelijk uitgelegd.echt Elektuur

cornevandijk
Автор

Well that was a bit anti-climatic. “How to use Arduino compiler to produce faster and smaller code” Spoiler: you can’t. What about registers?

ericbenjaminjr
Автор

Hi!
I'm trying to convince my manager to compiler our projects with optimization, but he says it's not functionally safe. He wants to use -O0, but then we run into CPU load issues.
In your article you write:
"Level -O0 is not used in comparisons as it is worst on every line and the compiler says it should not be used."
Do you have a reference to: "the compiler says it should not be used"?
And about functional safe code, do you have a reference to which level of optimization is considered safe? You mention that -Ofast is not safe, but how about the other levels, is it a simple ladder from -O0 to -O3 where each step involves more risks of a compilation induced bugs?

bearingef
Автор

I'd like to know about linking optimization as well...

zhuk