2024-04-13 01:32 AM
I was building some code to display graph on an lcd, and since I would gather data from serial input, I need it to be real time, then before enabling optimization I had got sure that I can receive and parse data really fast, but the display stage is not really efficient. Then I enabled level optimization by which I mean -O1. Following this change I saw a really significant performance improvement of display. Now my question is what is really happening in compilation when enabling this feature, how changing the c code to assembly code change, is it review the code to optimize or the code it generate for each operation would become lesser than the normal mode without optimization.
2024-04-13 01:47 AM
Optimizer is a part of the compiler and these ARM cpus are designed to work with a compiler, that generates code which really uses the features of the cpu. I use most time -O2 , is best balance speed/code size .
What Optimizer settings do , read :
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html