I have a java class that does really heavy bit decoding and manipulation. This class accounts to almost 96% of my total app’s execution time. I was wondering whether if I write some c code for these bit manipulation and use java native methods to load the c libraries, will I get significant increase in my performance?
Share
The only way I could see JNI/native code being faster is you can overcome the JNI call overhead by passing a large dataset to the native method for it to bit manipulate. Note that unlike Java methods, JNI methods cannot be inlined/optimized by hotspot. Native calls require copying values back and forth between the Java and Native memory areas.