Login  Register

Re: Negating some JNI call overhead by doing transformations in Java

Posted by Demoscene Passivist on Jul 21, 2011; 12:59pm
URL: https://forum.jogamp.org/Negating-some-JNI-call-overhead-by-doing-transformations-in-Java-tp3188212p3188442.html

>I'm not sure I understand you here. JNI is a factor for my application.
>Calling glRoatef for example in jogl would probably take a factor 10 longer than from a
>C program (probably more).

Are u absolutely sure about ur observation that JNI is the bottleneck ? Have u done any benchmarks ? I'm asking because usually most people "just think" that JNI has to be slow and blame every performance bottleneck on the JNI call overhead. The is a performance impact sure, but usually its around 10% and not 10x overhead in regard to native C :)

Maybe if u don't believe me let me quote Kenneth Russel (the guy that ported Quake 2 to JOGL): "We did fairly extensive experiments a couple of years ago with the Jake2 Quake II port to Java and were not able to isolate JNI overhead as being a culprit on any modern CPU. We have had good success in past years in translating several moderately-sized C++ demos and animation engines to Java and have uniformly achieved 90-100% of the speed of C, and sometimes even better than 100% because HotSpot generates machine code specific to the processor you're currently running on while many C binaries are compiled for a least-common-denominator processor." See here for the full discussion back in the days.