Mobile App Performance Redux
Just like before, I ran each test 10 times and took an average. However, I changed the logic a little bit from my previous test, which caused the new tests to be a little more computationally expensive. Here is all the relevant version numbers:
- Apple iPad Air 2 / iOS 8.2
- Apple iPhone 6 / iOS 8.2
- HTC Nexus 9 (2014) / Android 5.0.1
- Motorola Moto X (2014) / Android 5.0
- Xcode 6.3 beta 3(6D532l)
- Android Studio 1.1.0
- RoboVM 1.0 (220.127.116.11503101143)
- RubyMotion 3.6
- Xamarin Studio 5.8 (Xamarin.iOS 18.104.22.168 / Xamarin.Android 22.214.171.124)
- J2ObjC 0.9.6.1
- Titanium Studio 126.96.36.199410281727 / Titanium SDK 3.5.0
The source is located here: https://github.com/harrycheung/Mobile-App-Performance.
- Xamarin crushes my benchmark and is (no longer) the king of the hill. At over 30% quicker than Objective-C, I find it hard to find a reason not to use it. An eagle-eye will remember there is a big difference between this result and the result from my original post. @migueldeicaza pointed out I should not be using DateTime.UtcNow since it has performance limitations. It turns out I had some cruft so I took it out, and this was the result. The performance is so great that I have to imagine there is some magic involved.
- With the addition of Objective-C, we see that J2ObjC does a pretty good job of transpiling the Java code to Objective-C with only a 10% performance hit. When Swift is added to the picture, both the Objective-C and J2ObjC hybrid apps perform the same. This leads me to conclude the Swift bridge overhead was pretty significant.
- RoboVM has been officially released, and the performance is still outstanding, especially since I can compare it against Objective-C. I just really wished they supported Xcode storyboards.
Update 3/17/15 9pm
@jl_hfl pointed out that I was handicapping Swift by using class instead of struct for Point. I restructured my code and we have a new king of the hill. I love seeing these performance increases with small tweaks. Please keep sending in the suggestions. Let us get each app optimized!
Update 3/19/15 3pm
Everyone has been asking for this so here it is. I ported my logic to C++. As expected, the C++ port performs the best on both platforms. What is incredible is how close Swift, Xamarin, and RoboVM are to C++ performance. Now, I will let someone else come up with an assembly port.
Update 3/22/15 5pm
Update 3/23/15 10am
I added results for the iPhone 6. When I ran these tests on the iPhone 6, I noticed that J2ObjC was outperforming Objective-C. I confirmed this on my iPad 2 Air. The biggest difference between when I originally ran the iPad tests and now is a little code restructure. Before, the code was not technically sharing the logic between apps. I copied the logic files to each project, and there might have been code divergence. Recently, I consolidated all the shared logic into one place so that each project pulls from the same files.
In general, it seems that the iPad Air 2 does not have a huge speed difference from the iPhone 6 in single core processing. The CPUs are very similar between the two devices with the exception that the iPad has one more core and a 100 MHz speed bump. However, notice that WKWebView performs the same on both devices. I am not sure what to make of that. Usually, that indicates being disk or network bound, but my app does not use any of those resources.