Xamarin Ported Android to C#. Results: Massive Performance Improvements over Dalvik

Xamarin has been providing Mono, a C# framework that can work on Linux for some years, and more recently they have also launched Mono for Android and iOS so that you can write or re-use existing C# application on the most common samrtphone platforms.

But their latest project “XobotOS Research Project” goes much further, as they have entirely re-written Android Dalvik engine based on Java with C#. Considering the million of lines of code in Android, they have found a tool to automatize the Java to C# conversion. This tool is an Eclipse plugin called is Sharpen, and Xamarin has made further improvements to Sharpen which are available on Github.

They already have ported Android 2.x and Android 4.0 to C#. If you wonder why they would do that, look at the “benchmarks” below showing Mono vs. Dalvik implementation of Android for binary tree, jovian and hashtags.

Massive difference in the performance of structs and generics in binary tree implementation in Java and C#
Mono vs Dalvik Android Benchmarks

Since the company focuses on mobile apps, Xamarin amazingly explains that this implementation has just been done for “fun” and they have released XobotOS source code. However, this was not done in vain and some of the work will be implemented in their future products namely:

  • Direct Graphics Access to Skia: Mono for Android currently accesses the graphics libraries through Java, but thanks to the code written for XobotOS, Mono will be able to access the native rendering code in Skia.
  • Java to C# tooling:  As mentioned above, a new  improved version of Sharpen is available as part of XobotOS release.
  • Replacing Java code with C# code: They will be able to replace some chunks of Java code with C# code to improve performance.

You can read Xamarin’s Android Ported to C# blog post for further details.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
1 Comment
oldest
newest
Khadas VIM4 SBC