Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In those cases you could of course opt to write the high-performance bit in C and have Java call that. No reason to stick to one language if performance is critical.


The overhead of calling a JNI function is considerable so this only works for functions that do a relatively large amount of work. There are also a ton of other drawbacks to this related to the fact that you've now escaped the JVM, miss out on the management of memory for those functions (so better make them stateless) and a host of other potential pitfalls depending on what platform you're doing this.

Definitely not an 'of course', and for critical performance if the function is small enough it might actually be slower to write it in C and call it from the JVM.


Indeed, you need a relatively large direct ByteBuffers and optimally paralyze the JNI call to take benefit of multi-core. It's a non-trivial task to get stable performance boosts unless the data volume is sufficient.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: