5 ms·
I didn't even know the plt existed... Fascinating. I'm curious if other JITd runtimes (like the jvm) offer the same optimizations
by exabrial 8y ago
I didn't even know the plt existed... Fascinating. I'm curious if other JITd runtimes (like the jvm) offer the same optimizations
- dfox 8y agoTHis is essentially free optimization for every JITed runtime that is capable of inlining FFI calls because you get the real entry point from dlsym() and there is no sane way to get address of the .plt indirected entry point. On the other hand JVM AFAIK is not capable of inlining FFI calls (at the least because there is no API for direct FFI calls).
- electrum 8y agoThe 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.