In most embedded systems, C and C++ languages are commonly used as effective languages to control devices. In contrast, in embedded systems operated via the Android platform, developers should create applications by using Java language provided by Android SDK.
Generally, Android applications, based on Java language, are slower than applications written in native C/C++ languages when the program needs to execute complex operations because Android applications are executed on Dalvik Virtual Machine.
Such Android applications based on Java language make it difficult to manage all kinds of devices by using only Android frameworks.
We show the difference in terms of performance between an Android application using native C library and an Android application using the same algorithm written in Java language only. This paper presents a guideline for an effective way to use native code libraries in android applications.
We conducted an experiment in five parts. First, we measured JNI communication delays that occurred due to using the JNI. And we found that these delays do not have influence on the experimental results because of its slightness.
In every part of the experiment-integer calculation, floating-point calculation, memory access algorithm, heap memory allocation algorithm, using native C library achieves faster results than using the same algorithm running on Dalvik virtual machine only.
It is worth noting that the memory access algorithm test showed a considerable performance difference depending on whether or not the native code library was used.
We recommend that Android application developers use the native C library when the application frequently requires memory access and that needs complex calculations under correct usage.
To read more of this external content, download the complete paper from the author archives.