Issue
In some computer logic, I think that the native c code (called from java native method) will run fast than java. Then It seems that I have to use ndk in this case.
However google said that:
Notably, using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity
So I am confused. Is ndk necessary?
Solution
The NDK is necessary. Whether that has anything to do with your case or not is pretty hard to tell, since you haven't given specifics.
Unlike server-side Java, C code can actually be significantly faster than its DVM equivalent. On the other hand, as the docs point out, it usually isn't. It takes a significant amount of time to cross the native boundary. A loop that calls an NDK method will, likely, not see a significant change. A loop that is implemented entirely on the C side of the NDK may, very well, see significant change.
Note also, that if you choose to use the NDK, you are significantly limiting the devices you support. You can produce a fat binary that has multiple versions of your lib, one for each supported device. Of course that affects the size of your app and doesn't guarantee that it will run on some new phone.
Answered By - G. Blake Meike
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.