I recently bought an iPhone 5S (this is partly why I’ve taken a short detour from the platform game – this will resume in my next post!). Once again Apple have managed to create hype around a new CPU which (according to Apple) is as powerful as a desktop PC. Now a desktop PC could range from a crappy little Atom to a new Mac Pro, so the term is perhaps a little vague.
I’m going to try to define it 🙂
So I go back to my Raytracer. Modified the code a tiny amount, so it runs on my Mac under Mono and iOS under Xamarin iOS. This seems pretty fair to me – Mono-a-Mono if you will. Then I moved it to Android and tested on Windows as well – because why not?
So how does a mobile ARM Dual Core CPU running (according to reports) somewhere around 1.3Ghz compare to an i7 Quad Core with hyper-threading @2.6Ghz? Or a Snapdragon quad-core on a different mobile OS?
All builds in release mode, tested outside the debugger (in no particular order):
|iPhone 5S||3.43||iOS 7||Xamarin iOS 7.03 (sgen/llvm)||A7@1.3Ghz x2|
|Macbook Pro Retina (2012) (i7 3720QM)||1.04||MacOS Mavericks||Mono 3.3 sgen||i7 @2.6Ghz x4 (x2 HT)|
|Macbook Pro Retina (2012)||0.20||Windows 7||.NET 4.5||i7 @2.6Ghz x4 (x2 HT)|
|iPad 3||9.6||iOS 7||Xamarin iOS 7.03 (sgen/llvm)||A5X @1Ghz x2|
|iPod Touch 4th Gen||DNF||iOS 6||Xamarin iOS 7.03 (sgen/llvm)||A4 @ 800Mhz|
|Nexus 7 (2013)||2.5||Android Jelly Bean 4.3||Xamarin Android 4.10||Snapdragon S4 @ 1.4Ghz x4|
|Samsung S4||3.2||Android Jelly Bean 4.3||Xamarin Android 4.10||Snapdragon 600 @1.8Ghz x4|
|i7 W3520||0.68||Windows 7||.NET 4.5||i7 Xeon @2.67Ghz x4 (x2HT)|
|i5 E6410||0.44||Windows 7||.NET 4.5||i5 @2.67Ghz x2 (x2HT)|
|Intel Atom||5.32||Windows 8.1||.NET 4.5||N270 @ 1.6Ghz (x2HT)|
Try the code on your own machine – source here (as I quickly and dirtily knocked this together you’ll see I don’t do any clever code sharing – maybe a second pass later!). I haven’t optimised this at all, but the core code is *exactly the same* so is as fair as I can make it – the only different is how the results are displayed.
What does this prove?
Nothing really. But I was bored and fancied seeing how fast my own code ran on my new toy. Is the A7 a desktop class processor? Well it’s somewhere between an Intel Atom and an Snapdragon S4/600, so you should make your own call there. It’s pretty fast, regardless of how it compares to a desktop CPU.
There are some unexpected results above – the i5 being faster than the i7 Xeon and the Nexus 7 being faster than the S4, but each test was run multiple times and the figures were the average of 3 runs with outliers excluded.
I guess if anything it proves that Microsoft/Xamarin have done an awesome job on giving me the tools to have an idea, code it in minutes and run it on 4 different platforms really easily. And that’s a good thing, right?