- Home /
Just how slow is the JNI?
We're writing an Android plugin, and we expect to have as many as a few tens of calls across the C#/Java boundary. While this cannot be helped, there is a question of how to transfer data over that boundary. The most straightforward way is simply querying a resulting AndroidJavaObject on the C# side, but if it has many properties, that amounts to many JNI calls. The alternative is to pass custom data structures, and indeed the Facebook plugin serialises all parameters between calls into JSON strings (!).
What is the best approach? JSONs are not cheap themselves, and implementing custom binary serialisation takes time. If we expect a three-digit call count through JNI per second, how much of performance hit will that be?
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613121814im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Now that Unity 4.1.2 broke the Android plugin examples, what do you use to learn them? 1 Answer
How to call an android notification plugin if it's not the main activity? 1 Answer
Getting byte[] or ByteBuffer[] from native Java 1 Answer
Using two Unity Android Plugins that want to be the main activity? 1 Answer
CreateJavaRuntime problem 0 Answers