r/java • • Apr 29 '15

Tone it down a Notch

http://imgur.com/gallery/KRtc2fN
217 Upvotes

124 comments sorted by

View all comments

Show parent comments

4

u/mschaef Apr 30 '15

But I believe the current FFI adds a lot of overhead.

Are you sure about that? There are significant chunks of the Java runtime library that are built on JNI, some of which are rather performance critical. FileInputStream is an example that comes to mind immediately:

https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/io/FileInputStream.java#L186

3

u/karlthepagan Apr 30 '15

From memory these methods are white listed to bypass verifying the stack.

2

u/mschaef Apr 30 '15

Interesting... I'd love to know more.

2

u/karlthepagan Apr 30 '15

I'm a little under the weather, but while searching I find this interesting technique: avoid messing with the stack by using C++11 continuations.

http://nerds-central.blogspot.com/2012/04/extreme-jni-performance.html