Optimizer Assistant is a static code analysis tool that scans source code and provides advice on how the code could be changed to improve performance. In addition it can also help with determining the ideal set of build options for obtaining the best optimization while staying within code size constraints.
The initial analysis of the source code takes place automatically during the build and any advice will display in the **Advice** view. Selecting an item in the **Advice** view will open up a window providing more information on how the code may be improved.
To determine the ideal set of build options for your project, select the **Optimizer Assistant** from the **View** menu. Click on **Start Analysis** to begin the analysis.
Use the drop-down box to choose which compiler option to experiment with:
- Speed vs size trade-off (--opt_for_speed) or
- Optimization level (--opt_level).
The Optimizer Assistant will build the project several times using multiple sets of build options. Depending on the size of the project this operation may take some time. When the tool has finished building the project it will show a graph that compares the results for each of the combinations tested.
##Speed vs Size optimization
The graph below shows the resulting code size for each of the values of speed vs size option. From this you can choose the highest setting that still meets your code size constraints.
The color scheme:
- Yellow - It fits, but you can do better.
- Green - Recommended.
- Red - It doesn't fit. Not enough memory is available to hold everything.
A check mark is shown next to the current project setting for the speed vs size option.
The green bar is usually going to be the largest one that still fits. All other things being equal, this setting is likely to be faster than any of the yellow bars.
The graph below shows the resulting code size for each of the values of optimization level.
The color scheme:
- Blue - It fits.
- Red - It doesn't fit.
A check mark is shown next to the current project setting for the optimization level.
There is no green bar, because the best choice is more complicated. For example, if ease of debug is a concern, you might choose the lowest optimization level that still fits.
In the results window, hover the mouse over one of the rows to see a pop-up similar to this:
The pop-up window allows you to click on one of two choices:
- Apply this setting to your project
- Debug the program generated with that setting
By clicking the first choice you can change your project options to always build with that setting. By clicking the second choice you can do a test run of the system built that way to see things like performance and power consumption.
The video [here](https://www.youtube.com/embed/kiqe-Cdp8DY) provides an overview and demo of using Optimizer Assistant in CCS.