MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Performance management

This section provides best practices for improving the performance of your applications, such as how to:

What is performance?

Performance typically refers to the overall speed or productivity of a system. It covers issues such as:

  • Processing speed and hardware capabilities
  • Response, reaction times, and latencies
  • Device use time and power consumption
  • Data throughputs and bandwidths
  • Load produced on the hardware and corresponding system resource usage
  • Reliability and stability

Good performance comprises:

  • Optimal algorithms that are suitable for the planned use cases and required data volumes
  • Minimal communication between separate process instances
  • No unnecessary wake-ups or continuous polling of some resources
  • Minimal use of disk and network IO
  • Minimal activities when screen backlight is off or application is not visible in the screen

Performance can be lost due to:

  • Crashing software - in the worst case, software may not work at all
  • Wrong kinds of algorithms and data structures, which can totally demolish performance
  • Running low on memory (for example due to memory leaks)
  • Almost full disks, which slows down IO operations
  • Copying memory around because it is slow in OMAP3/ARM architecture
  • Heavy loops that contain unnecessary or slow instructions, or extra iterations
  • Extensively using of floating points, because they are significantly slower to use than integers

Ensuring the performance of your mobile application

When developing applications for mobile devices, you must take performance issues into account during all stages of the application development process. Especially consider the available memory resources, battery life, CPU speed, and network connections of the device. To ensure the performance of your application, measure, analyse and optimise the performance iteratively and continuously throughout the whole project. The following figure illustrates the process of optimising the performance of your application.

Optimisation process

If you encounter performance issues:

  • Always measure and analyse before you optimise.
    • Otherwise you can end up optimising wrong parts of the code, which is futile.
  • Use realistic test cases during optimisation.
    • To ensure that you optimise the correct parts of the code, do not use too light (or heavy) test cases. Algorithms may work with unrealistic speed.
  • Measure after each optimisation.
    • Incorrect optimisation can slow down the software. Without measuring afterwards, you may overlook the mistake, which can degrade the performance instead of improving it.
  • Do only one optimisation at a time.
    • When you optimise the fragments of your code that form a bottleneck, the internal balance of the application may change heavily. After the optimisation, another bottleneck may be in a totally different place than you initially identified before carrying out the first optimisation. Thus, if you optimise several places in your code at the same time, the effort for all but the first one may be lost.
    • Performance optimisation may have some unexpected side effects in the system. For example, if you optimise the code of an application and remove a specific bottleneck, some other part may start to behave badly because it receives more input at a faster speed from the optimised application. If you perform more than one optimisation at once, it is much more difficult to identify which modification caused the behaviour to change.

You can also find important information related to performance in the publishing guidelines for Harmattan applications and Unix Filesystem Hierarchy specification.