Page 1 of 1

"Optimize: ...." what does it do?

Posted: Sun Jan 29, 2023 10:19 pm
by not_defined
Hello. What do Smallest, "Fast (-O1)", "Faster (-O2)", "Fastest (-O3)" do in "Tools > Optimize:" in Arduino IDE? Which one to choose for which situations?

Re: "Optimize: ...." what does it do?

Posted: Mon Jan 30, 2023 7:01 am
by ag123
use -Os smallest unless your chip has lots of sram and flash, -O{2,3} etc is intended to be optimized for speed, more often at the expense of flash and sram. Not all chips can benefit from it, e.g. stm32f4xx and higher series (e.g. f7, h7) are more likely to benefit from those optimizations as the chips has more hardware to benefit from those optimizations

Re: "Optimize: ...." what does it do?

Posted: Wed Mar 01, 2023 8:20 am
by firstwaterpolo
frequent at the price of sram and flash memory. Nevertheless, the stm32f4xx and later series (such as the f7 and h7) are more likely to reap the rewards of these enhancements since they have more hardware capable of handling them.

Re: "Optimize: ...." what does it do?

Posted: Tue Mar 14, 2023 1:10 am
by Boaslo
To my knowledge -Os is the smallest unless your chip has a lot of sram and flash, -O{2,3} is used to maximize for speed, often at the expense of flash and sram.