Does anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java? [closed]

Solution 1:

Yeah, Xamarin's Mono virtual machine is more impressive than Google's Dalvik used in Android. I have tested it with HTC Flyer and Acer Iconia Tab tablets to benchmark the C# port of Android through Mono against Java Dalvik, with the C# implementation of Android well and truly trouncing the Java-based Dalvik.

Solution 2:

I came across this interesting post

https://medium.com/@harrycheung/mobile-app-performance-redux-e512be94f976#.kfbauchtz

Android App Performance

iOS App Performance

Hope this information helps.

Solution 3:

We recently investigated using Xamarin for an app. We utilized the C# code we had already written for the Windows RT version of our app. Some specific details had to be rewritten for the Android version.

What we discovered is that I/O in Xamarin C# is approximately 2x slower than Java. Our app is heavily I/O bound. We have not discovered the cause of this yet, but at the moment we are assuming that it is due to marshaling. While we do try to stay inside the Mono VM most of the time, we do not know how Mono actually accesses the disk.

It is also telling that our C# code uses SQLite.NET (https://github.com/praeclarum/sqlite-net). Identical fetches using the SQLite.NET code are also 2x slower than using Android's Java SQLite wrapper. After looking at the source code, it appears to bind directly to the C .dll, so I do not know why it's so much slower. One possibility is that marshaling strings from native to Java may be faster on Android than native to C# is on Xamarin.

Solution 4:

This is another more updated blog post I would like to share with you. He compares Xamarin to native code and Cordova on both IOs and Android.

In a nutshell, Xamarin performs sometimes better than native code. He tested the app size, load times, loading a list from Azure service and prime number computation.

Enjoy!

Edit: I updated the dead link and I noticed that there is a part 2

Solution 5:

Here are a few informations I found in another test between native, Xamarin and Xamarin.Forms solutions (the tests also include iOS performances) on the two following devices :

Samsung Galaxy A7: Android OS version: 6.0 Central-processing unit: Octa-core 1.9 GHz Cortex-A53 RAM: 3GB Display resolution: 1920×1080

iPhone 6s: iOS version: 10.3.3 Central-processing unit: Dual-core 1.84 GHz Twister RAM: 2 GB Display resolution: 1334×750

Comparison is made on a few common features, each one with its own application :

- Basic “Hello World”
- REST API
- JSON Serialization/Deserialization
- Photo Loading
- SQL Database Insert and Get All

Each test is repeted several times, the graphs show the average results.


Hello World

Basic Hellow World performance comparison


Rest API

Set of tests aimed at measuring the time it takes for the app to send a request through REST API and receive the response back without further data processing, using OpenWeatherMap API.

Rest API performance comparison


JSON Operations Tests made using Newtonsoft Json.net framework to serialize and deserialize JSON objects in all Xamarin apps. Native Android serialization and deserialization tested using two Java libraries: Jackson and GSON.

Two runs are made, one first from scratch and a second one with cached infos and operations

First run :

JSON serialization first run

JSON deserialization first run

(Native iOS JSON Operations is killing this test btw, and Xamarin joins it in the second)

JSON Serialization second run

JSON Deserialization second run


Photo Operations

First load on images with three different resolutions :

Resolution – 858×569, Size – 868Kb
Resolution – 2575×1709, Size – 8Mb
Resolution – 4291×2848, Size – 28.9Mb

Image First Load Android

Image First Load iOS

Something seemed unsure about the Xamarin.Forms results for this test, so it is not included in the graph.


SQLite Operations

Two operations tested :

BulkInsert: Loading rows of data into a database table.
GetAll: Retrieving all data from the database.

With databases having 10,000 records. All operations were processed internally on devices.

SQLite Android performances

SQLite iOS performances


Xamarin Native (Xamarin.iOS/Xamarin.Android) show themselves as rather good alternatives to the native code, whereas Xamarin.Forms seems slow in a lot of cases, but it can be a really good solution to develop really simple applications fastly.

Complete test comes from this source :

https://www.altexsoft.com/blog/engineering/performance-comparison-xamarin-forms-xamarin-ios-xamarin-android-vs-android-and-ios-native-applications/

Thank you for giving me the explanations to enhance my answer, hope this helps a little :)