table of Contents
ARM Compiler 6 optimization level introduction
ARM Compiler 5 optimization level introduction
ARM Compiler 6 optimization level introduction
-O0: No optimization. Not recommended for use in ARM Compiler 6.6
-O1: Limited optimization. This is the current recommended level of source code level debugging.
-O2: Optimize speed. Due to many loop unrolling and function inlining, the code size will increase.
-O3: Optimize speed. Faster than -O2 generated code, but larger
-Os: Balanced optimization. The speed of optimization and the increase in code size are reasonable.
-Oz: purely optimize code size
For detailed understanding, please refer to Migrate from ARM C/C++ Compiler 5 to ARM Compiler 6 https://www.keil.com/appnotes/docs/apnt_298.asp
ARM Compiler 5 optimization level introduction
Reference: https://blog.csdn.net/zhuimeng_ruili/article/details/108208012
Comparison test:
ARM Compiler 5 provides 4 different optimization levels 0 to 3 . Their behavior is related to the optimization level, the higher the optimization level, the smaller the code.
There is no direct relationship between the optimization levels of ARM Compiler 6. You can compile the project under each optimization level and select the optimal optimization level.
Code size comparison after compilation
ARM Compiler 5 in -O3 optimized compiled class code size
ARM Compiler 6 in -Oz optimized compiled code size, found in the Level ARM Compiler 6 the compiler -Oz Optimization level, minimum compiled code.
It can be seen that only from the size of generated code, ARM Compiler 5 has more advantages