title: Native code as separate process vs JNI
body: <p>My current project involves an Android app with some existing native code. As far as I know, I can either use the code as a separate binary which will be run in a separate process or through JNI which allows simpler communication.</p>
  
  <p>Is it true that JNI should usually be preferred over the over approach? The native code (which was written to be compiled into a UNIX binary) really relies on continous performance. It should not be affected by other code (e.g. Android views, activities, processes, threads...) at all, at least in theory. Practically, our goal is to keep it as performant as possible. Will JNI cause performance problems, especially in the terms of communication overhead and VM threading?</p>
  
  <p>A separated binary would have the benefits
  - that it is simple to maintain
  - that the existing native code base does not have to be changed (except from compatibility changes, of course)
  - that the process running the separated binary might be less vulnerable to performance impacts than the single-process JNI solution.</p>