Content area
Mobile and wearable devices are capable of executing increasingly complex and privacy-sensitive tasks, all while remaining bound by strict energy and latency constraints. This dissertation investi- gates how utilizing low-level code can improve performance and efficiency on Android devices in contrast to the standard Kotlin/Java toolchain. After reviewing the state of the art, four studies were conducted using both Kotlin and C/C++ with the Android Native Development Kit (NDK). These studies focused on prime number generation, using the Sieve of Eratosthenes, the Fast Fourier Transform (FFT), and square matrix multiplication. Additionally, we developed an Android ap- plication that performs wake word or hotword detection using TensorFlow Lite C API, followed by voice command recognition for a limited set of commands after detecting a wake word.
The exploration of the algorithms revealed that native code offers limited benefits for the Sieve algorithm, achieving only a 1.4x speed-up in the best-case scenario, with performance degrading as the input size increases. However, native code provides better control over memory usage, enabling the processing of larger input sizes than the Kotlin approach. The iterative FFT imple- mented in native code achieves a speed-up of 5.82x for an input size of 220, with performance improving as input size increases. While the matrix multiplication algorithm achieved a speed- up of 6x in a matrix size of 2048, utilizing the compiler's -O3 optimization flag, which enabled instruction vectorization.
Moreover, the development of the wake word detector and voice command recognition appli- cation using the TensorFlow Lite C API allowed on-device real-time processing while also incor- porating noise and voice activity filtering. One of our goals was to compare a native implementa- tion in C with one in Kotlin to explore potential optimizations. Empirical evaluation confirmed a functional audio pipeline that consumed approximately 200MB of memory and could sustain up to 41 hours of continuous listening in an environment composed of equal portions (33,3...% each) of silence, random noise, and human voice.
Details
Machine learning;
Software;
Java;
Programming languages;
Software development;
Application programming interface;
User experience;
Fourier transforms;
C plus plus;
Neural networks;
Wearable computers;
Energy efficiency;
Libraries;
Energy consumption;
Artificial intelligence;
Energy;
Mathematics;
Sustainability