BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

XobotOS: Android Build on C# Instead of Java

by Jonathan Allen on May 02, 2012 |

Miguel de Icaza, Mono’s founder, recently announced the creation of the XobotOS research project. XobotOS is the Android operating system with all Java code removed and C# code put in its place. Miguel offers two compelling reasons behind this research project:

Unlike Sun with Java, Microsoft submitted C# and the .NET VM for standardization to ECMA and saw those standards graduated all the way to ISO strong patent commitments. The .NET framework is also covered by Microsoft’s legally binding community promise.

The second is an issue of platform maturity:

Over and over we came back to the basics: Dalvik is a young virtual machine, it is not as performant or tuned as Mono and suffers from many of Java’s performance limitations without the benefit of the high-end optimizations from Oracle’s HotSpot. One crazy idea that the team had at that dinner was to translate Android’s source code to C#. Android would benefit from C# performance features like structures, P/Invoke, real generics and our more mature runtime.

In order to translate the over 1 million lines of Java code in the Android operating system the Xamarin team turned to a project called Sharpen. Using some simple benchmarks comparing generic support in Java and C# they were able to show some significant improvements. The below chart is part of the aforementioned press release:

There is a XobotOS github site available, but Xamarin does not plan on supporting the project directly. Instead they will be using what they learned to improve the performance of their Mono for Android product by replacing performance sensitive code Java code with C# alternatives. In addition to C#’s apparent performance benefits, this would reduce the number of marshaled calls between the Mono and Dalvik virtual machines.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Cool project, but I could do without the hype by peter lin

Don't know about other people, but using machine translation to port Android to C# is cool. I could do without the hype and exaggeration. Mono has always been slower than Microsoft's CLR and the GC has always performed worse than Microsoft CLR and Sun Hotspot. The early decision to NOT use generational GC was a huge mistake and smells of NIH syndrome. Mono is "maturing", but I wouldn't say it is more mature than Dalvik. Judging the maturity of a software product based on superficial criteria like "age" is flawed.

The most mature VM today is Azul's. Nitpicking aside, it is nice to have C# as an option.

Re: Cool project, but I could do without the hype by Jonathan Allen

I don't think it is appropriate to consider compare Mono to .NET or Hotspot in this context, as they are only claiming to be better than Dalvik. And they have been working on their VM a lot longer than Google has, so their claim is at least plausible.

And really, what do we know about Dalvik? All I personally know is the uses a register-based VM instead of a stack based VM like Java and .NET, which means a lot of the research into that area cannot be reused. It's JIT compiler is less than two years old (it's birthday is the 20th), and I heard (unconfirmed) claims that Dalvik does not yet have a generational garbage collector.

If you show me evidence otherwise I'll believe you, but right now the guys at Mono are only source of expert opinion on the matter.

Re: Cool project, but I could do without the hype by peter lin

I agree Mono has been around longer than Dalvik. I have no proof Dalvik is more or less mature than Mono. My point is that using age as the only basis of judging "maturity" is flawed at best. Only real way to know would be to test it under a wide variety of workloads and gather GC statistics to characterize the performance. Even then, there's going to be certain types of workloads that each is good at. Just like JVM and CLR each have sweet spots.

The Mono guys are experts at Mono, but it would be a stretch to claim they are experts in Dalvik. To really get a full and complete picture would be to have both teams do an exhaustive test and compare notes.

My original point is Mono's hype is silly. The project is neat, but there's no need for all that hype.

I like it.. by M Vleth

..but to use the word 'mature' for Mono (or the CLR for that matter) shows a real lack of sense for reality. Would be great if they matured though, since IL is in fact more mature as bytecode.

Re: Cool project, but I could do without the hype by Cameron Purdy

In general, JIT compilers start by translating a stack machine model into a register-based model, and that is (according to the Hotspot JVM developers) a relatively simple thing.

And really, what do we know about Dalvik?


Really? Seriously? Perhaps you could .. um .. "google" it?

(And really, what do we know about Mono?)

Re: Cool project, but I could do without the hype by Jonathan Allen

Try it. Perhaps you will have more luck but I haven't seen much on the Dalvik runtime itself.

Mono, on the other hand, has been quite vocal about their work. They regularly talk about where the VM is weak and what they are doing to improve it.

This is not unexpected. Mono is a choice, so it needs advertising. Dalvik is a default, if you choose Android you get it whether you want it or not.

Re: Cool project, but I could do without the hype by Cameron Purdy

Try it. Perhaps you will have more luck but I haven't seen much on the Dalvik runtime itself.


I found the source code for Dalvik on source.android.com/

Since you caused me to look, I decided to take a peak at these "significant improvements":

Using some simple benchmarks comparing generic support in Java and C# they were able to show some significant improvements.


Improvements? Judge for yourself:


for(int i=1; i<=n; ++i) {
hashtable.put(i, 1.0f / i);
}

My oh my, that looks like a micro-benchmark of Java doing auto-boxing versus C# not doing auto-boxing.

I honestly can't believe you are repeating this nonsense. This was old news five years ago.

(To be clear, this is an example of where C# has improved on Java. That would have been a legitimate technical point. In fact, it is a legitimate point, and it's been made ad nauseum over the past half-a-decade.)

Extrapolating from a few flawed (apples vs. oranges) micro-benchmarks is bad enough, but at least the people doing the benchmarks had a horse in the race. The real question is why you would parrot their nonsense?

Peace,

Cameron.<//pre>

Re: Cool project, but I could do without the hype by peter lin

Wow, all that hype for so little. I'd like to see something substantial like an actual application that a real person would want to use. Hopefully InfoQ won't make the same mistake again.

Lots of bitterness from the usual suspects by Dan Tines

You got Peter Lin that throws a fit anything Mono-related comes up and Cameron (who works for Oracle) who has been trolling against .NET on the server side for years.

Don't worry guys, it's been thrown on Github and it's basically been said that Xamarin isn't going to pursue anymore out of it.

Changing the subject? by Cameron Purdy

Dan,

Lots of bitterness from the usual suspects


So instead of addressing the criticisms raised, you just launch straight into an ad hominem attack.

First of all, this isn't about .NET or Java (both of which I work with, and both of which I like just fine). It's not even about Mono or Dalvik (neither of which I work with, but I'd put a 99% chance of liking them if I did get to work with them). Come on, the article (i.e. the editor) asked "And really, what do we know about Dalvik?" And then proceeded to parrot Miguel's purposefully-misleading micro-benchmarks. That's lousy from almost any perspective.

However, if you want to turn this into a conspiracy, then by all means don't let rational thought stand in your way.

Re: Lots of bitterness from the usual suspects by peter lin

I have zero bitterness about Mono. I just don't like hype, no matter where it comes from. When spring hypes stuff, I complain. When other projects have silly hype, I complain. On the contrary, I am happy that Mono exists. It means I can write C# app and deploy it on Linux. I've used it in the past for my open source XML Schema compiler, which I wrote in C#. It works perfectly fine in CLR or Mono. I also have a RETE rule engine for C#.

Just because I don't blindly jump for joy when some project does a hype PR release, doesn't mean I dislike the project. I do play devil's advocate and "throw a fit" as you say. I've been known to "throw a fit" against CEP hype, business rules hype, data grid hype and every other retarded PR release.

I just call it as I see it. I don't feel it's fair to claim Cameron is trolling.

I on the other hand definitely troll, especially when someone says "spring is light, maven is awesome and x will solve all your problems." On the other hand, when a PR release is grounded and doesn't resort to BS non-sense, I generally post positive comments.

C# ECMA specification by Wendong Li

"Unlike Sun with Java, Microsoft submitted C# and the .NET VM for standardization to ECMA ..."

On Wikipedia it says: "As of December 2010, no ECMA and ISO/IEC specifications exist for C# 3.0 4.0, and 5.0."

Anyone knows about the current status?

Re: Lots of bitterness from the usual suspects by Mark N

Peter, Dan must be thinking about your feelings about Maven. :p

Re: Lots of bitterness from the usual suspects by Mark N

I have been following posts by Cameron and Peter for years. I don't remember this being the case with Mono OR .NET with them. Not everyone likes everything about everything but that does not constitute what you describe. As Cameron said, "his" product supports .NET and I think Peter has an opensource one that does.

Re: Lots of bitterness from the usual suspects by peter lin

Guilty as charged! I have a love & hate relationship with maven. I love to hate it and hate it passionately. I have zero objectivity when it comes to maven :)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

15 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT