Are programs written in Java for Android slower than equivalent written in C embedded into Objective-C for iOS? Are programs written in Java for Android slower than equivalent written in C embedded into Objective-C for iOS? android android

Are programs written in Java for Android slower than equivalent written in C embedded into Objective-C for iOS?


Good question. Several years ago the performance of the Sun (now Oracle) JVM would pale in comparison to native code. But things have changed.

Firstly, the VM running Android isn't your standard JVM. Its a beefed up VM rewritten by Google specifically for mobile use, where UI performance is given priority.

Secondly, a lot has happened over the past decade... a quote from this relevant article puts it nicely: Fifteen years ago, all we thought that Java needed to rule the known universe was a faster VM. We now have a much faster VM.

Finally, there's been a lot written about comparisons between iOS and Android in terms of performance. Here's a fifth link just for kicks. There's plently more out there. It comes down to several factors - what type of code you need to run, what your performance expectations are, and how much you're willing to invest to squeeze out the most bang for your buck. And if you think Dalvik is your bottleneck, you're capable of writing native C/C++ and use JNI in Android.


You can not compare the performance in this way. Your application will run on different pieces of hardware with different performance characteristics. The differences in performance between java/objective c is most probably negligible compared to the influence of the hardware. You should analyze the bottlenecks of your application and check if the targeted hardware can support it. If it's implemented in java does not matter that much.


As a test I once wrote a test app that executed a sorting algorithm on a large random list.

The C version ran about 10 times faster than the same Java version.

I would suspect that you will typically see Java running about 5 times slower than the equivalent C on the same platform.

The platform it's running on will also influence the speed of course.