5

I have a project that currently executes many external programs using java.lang.Process. Assuming that their functionality is also available in native library form, what would be the advantages of executing said library functions using JNA instead?

The process executions are fairly heavy - they take a few seconds to complete. Am I correct in thinking that performance gains would be minimal?

Raedwald
  • 46,613
  • 43
  • 151
  • 237
teabot
  • 15,358
  • 11
  • 64
  • 79
  • This is one of those questions that just leaves me scratching my head, because it would be so easy to benchmark for oneself. – Jonathan Feinberg Feb 16 '10 at 19:18
  • 3
    To investigate this requires a time commitment. Given that SO users may already have some real world experience of using JNA I am hoping to determine whether performing such a benchmark is worthy of the effort. For instance - perhaps I have missed something obvious re: JNA and it would in fact be a pointless exercise even benchmarking it... – teabot Feb 16 '10 at 19:23

1 Answers1

3

You might find this helpful: Execute native code via JNI/DLL or EXE?

We went with native execution. As per the accepted answer, there is less risk of memory leaks and it's easy to restart the native process as needed.

Community
  • 1
  • 1
Marcus Leon
  • 55,199
  • 118
  • 297
  • 429