Improving Java Performance With Native Libraries
Seppälä, Niklas (2024)
Seppälä, Niklas
2024
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-202405059257
https://urn.fi/URN:NBN:fi:amk-202405059257
Tiivistelmä
The purpose of this thesis was to conduct in-depth research into available solutions for interfacing with native libraries from Java program, trying to identify the best solution for different situations. The study focused on JNI, JNA, and FFM API. The research was conducted for Profium.
The research relied heavily on Java language specifications and API documentations for source material, and supplementary benchmarks were created for comparing the different foreign function solutions in practice. Benchmarks evaluated Java wrapper objects utilizing indexing library implemented in C programming language.
The outcome of this thesis was that while native libraries can be used to improve performance, it is not always required. The first step should be to find bottlenecks in existing Java code and to try optimizing it. Utilizing native functions is most suitable for larger computing tasks, which do not require communication back and forth between Java and native code.
The research relied heavily on Java language specifications and API documentations for source material, and supplementary benchmarks were created for comparing the different foreign function solutions in practice. Benchmarks evaluated Java wrapper objects utilizing indexing library implemented in C programming language.
The outcome of this thesis was that while native libraries can be used to improve performance, it is not always required. The first step should be to find bottlenecks in existing Java code and to try optimizing it. Utilizing native functions is most suitable for larger computing tasks, which do not require communication back and forth between Java and native code.