Answer the question
In order to leave comments, you need to log in
Android: Java VS C++
I wrote a small application for android, but there is a decent “mathematics” plus work with a bitmap. In Java, the calculation takes a very long time. For comparison, on a desktop (2.5 GHz) the usual C++ version considers the task 3 seconds, on the same java-android desktop in the emulator, the task is considered 2 minutes.
In this regard, a question arises. Does it make sense to pervert with c ++ under android, will there be an increase in the speed of "mathematics", approximately what?
Thank you.
Answer the question
In order to leave comments, you need to log in
The android emulator is slow, it's better to see the calculation time on the device.
Does your version of Android use a JIT compiler? It seems to have appeared since Android 2.2.
With a JIT compiler, identical programs (as far as languages allow) will run at approximately the same speed.
But on the other hand, perversions in C ++ and inserts in assembler allow you to increase the performance of the program by an order of magnitude (and increase the number of problems for the programmer by an order of magnitude)
I would write a small and very simple study on which I would look at the real increase in speed in C ++.
If the increase is large enough (everyone determines the measure himself), then he would start writing in C ++.
There is an increase, how much depends on the specific task: java in android is quite slow, alas.
See what code you have. By and large, an overhead can be due to working with an array, perhaps, well, or from the bitmap itself.
In pure mathematics, you will not get a significant increase in speed without changing the algorithm.
Plus, do not forget that you need to transfer the layer to jni now - this is also the time.
What takes the most time in your calculations? What function is the bootle neck - bring it, then it will be possible to assess whether there will be a win.
Is it possible to write a library in C ++ in android and connect it to a Java project?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question