Best practices

When creating applications for embedded and mobile devices even seemingly small details can have significant impact on the performance of your Kanzi application on target devices. Kanzi OpenGL ES 2.0 pipeline is optimized to have no unnecessary GL calls, which allows getting 60 frames per second for 3D instrument clusters and human-machine interfaces. Use the best practices covered in this section of documentation to create optimal Kanzi applications for your target hardware.

Even though Kanzi provides many ways that enable you to create applications that consume less memory, CPU and GPU capacity, and device battery, how you create your application has a large impact on its efficiency.

Use the appropriate material type

Application optimization starts already with the selection of the correct material type for your project.

The vertex-based shading offered in the Fast performance vertex shaders material type is a good choice for mobile GPUs, because of the lower cost of vertex-based shading.

The type of shading used is often the first bottleneck that causes bad performance. See Shaders best practices.

../_images/use-appropriate-project-template.png

Clean up your project

In Kanzi Studio you can remove all items in a project that the project does not use. Removing unused items from your project does not always improve the loading times and performance of your Kanzi application. However, it makes optimization of your Kanzi application much easier because it helps you focus on optimizing the correct content. See Cleaning up your project.

Pay attention to the Log messages

Kanzi prints warnings and errors to the Log window and the Kanzi debug console to help you find the problems and bottlenecks in your Kanzi application. Pay careful attention to these messages. To ensure that your Kanzi application works correctly and performs optimally on your target platform, resolve all the issues shown in the warnings and errors. Even seemingly unimportant warnings can have a significant impact on the loading times and performance of your Kanzi application. For example, see Adjusting the data size.

Thread safety

Kanzi is thread-agnostic and does not guarantee thread safety.

To make your Kanzi application code thread-safe:

  • Do not call Kanzi functions from custom threads.

  • Synchronize between threads all access to shared data.