5 ms·
The JVM could do this, but there is a lot of other overhead for JNI calls (by virtue of the JNI API specification). Project Panama is working on improving nativ
by electrum 8y ago
The JVM could do this, but there is a lot of other overhead for JNI calls (by virtue of the JNI API specification). Project Panama is working on improving native interoperability: http://openjdk.java.net/projects/panama/ http://openjdk.java.net/projects/panama/
- exabrial 8y agoNice! I didn't know this existed, but this is great.
- MaxBarraclough 8y agoI was under the impression that although C->Java is slow, Java->C calls have been fast for years, with the JIT generating full-speed calls - https://web.archive.org/web/20160304055443/http://nerds-central.blogspot.co.uk/2012/04/extreme-jni-performance.html https://web.archive.org/web/20160304055443/http://nerds-cent...
- aardvark179 8y agoIt's fast, but it depends on exactly what you're doing. There is always a bit of work managing the stack and converting between ABIs, and JNI is quite poor in performance when dealing with anything other than primitive types. The sort of thing Panama is adding is support for layouts of structures so that you can get results to and from C quickly, along with things like expressing vector algorithms in a way that allows good optimisation on different CPUs.
- MaxBarraclough 8y agoSounds good. Better FFI is always good, and Java seems to be way behind .Net when it comes to utilising SIMD.