IAR Embedded Workbench generates the most efficent code in the industry. By making use of the many settings available, you can tune the tools to maximize the performance for your application.
Optimization level and type can be specified for the entire application and for individual files. In source code, the #pragma optimize directive allows you to do this even for individual functions.
The purpose of optimization is to reduce the code size and to improve the execution speed. When only one of these two goals can be satisfied, the compiler prioritizes according to the settings you specify.
Exploring the effects of the different transformations may lead to a better result. As an example, the fact that Function inlining is more aggressive for speed optimization makes some programs smaller on the speed setting than on the size setting.
Choose the smallest possible memory model available for your target.
By default, the runtime libraries are compiled at highest size optimization level. You should rebuild them if you are optimizing for speed.
Select the needed level of support for certain standard library functionality like, locale, file descriptors, and multibytes by choosing library configuration.
Select library options for scanf input and printf output formatters according to your needs. The smallest formatters are not selected by default.
Data types have big influence on code size/speed:
Check for target-specific options that gain performance, such as: