Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the fastest way to access native code from Java?

Which is the fastest way of calling a native library from Java?

The ones I know about are

  • NativeCall - what we're currently using
  • JNA - haven't used it, but looks reasonable
  • JNI - looks horrendous to write, but we'll do it if we get the speed
like image 482
Simon Nickerson Avatar asked Apr 08 '09 16:04

Simon Nickerson


1 Answers

Swig makes JNI easier too.

In terms of speed, I suspect there will be subtle variations - I strongly suggest you pick a call that you know you'll be making a lot, and benchmark all of the solutions offered.

like image 68
Jon Skeet Avatar answered Oct 27 '22 00:10

Jon Skeet