简体   繁体   中英

Is monodroid slower?

I have heard an android software can be developed by using C#. (monodroid)

But when I research it, someone indicated it will be more slow to run.

What do you think? Is it real? Is it effective using C#?

We don't know.

In all seriousness, it would be really handy if someone could port the Android Linpack app to Mono for Android so we could get a performance comparison between the two.

Here's what I do know:

  • There's a currently ~3s startup penalty overhead when first loading the app on a G1 (your mileage will vary depending on hardware). This is due to initializing the Mono runtime and loading up the referenced assemblies. We do want to improve this in the future.
  • Mono, and Mono for Android, JITs everything . Dalvik, meanwhile, has a JIT cache of variable size (currently 1MB on ARMv7) and an interpreter, so depending on your app it's possible (probable) that not everything will be JITed.
  • Mono for Android uses JNI to invoke Android/Java code.

Then there's koush's performance comparsion between Mono and Dalvik in 2009 . This predates the Dalvik JIT, but on identical hardware, Mono was spanking Dalvik.

So what does that all mean? I have absolutely no idea. (Again, a port of Linpack to Mono for Android would be wonderful! hint hint, nudge nudge )

That said, there is some performance advice to suggest:

  1. Use a splash screen during app startup. This provides immediate feedback during app startup, which is what most users care about.
  2. If at all possible, minimize transitions between Mono and Java code. JNI will never win any performance medals, so if you can do more code in Mono without intermediate calls to Java methods, do so.
  3. Minimize the number of Java.Lang.Object instances that are kept alive concurrently. Cross-VM GC references can cause performance issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM