Mono and Bionic Together At Last

I finally got Mono building in the Android build environment (I.e., a project located at mydroid\external\mono). The great part about this is that I am now doing cross compiles to build the project, as opposed to an ARM native build on the emulator; those were painfully slow. Converting Makefiles to Android.mk files was pretty tedious, but that didn't compare to the significant differences between glibc and Bionic (Android's libc implementation). When Google said Bionic was "lightweight", they weren't joking. For example, Bionic does not implement div. Seriously? (However, the cupcake branch seems to have it now)

Regardless, I have Hello World working linked to Bionic now, which is quite exciting. I also tried out some PInvokes on libGLES_CM.so (OpenGL ES), and the initialization function eglGetDisplay was working just fine. So things are looking good, and this project should be able to really start taking off now.

Edit:

Mono on Bionic is around 50% faster... check my original Mono vs Dalvik post for updated performance comparisons. I am guessing the speed increase is due to Bionic being compiled for the Thumb instruction set as opposed to ARM. Or maybe because Google is using some CPU/architecture specific compiler optimizations in their build process.

3 comments:

Jason said...

Hehe, really been burning the midnight oil getting it done I see. Are you going to try getting it added to the AOSP as an official external project?

Anonymous said...

Strange, the thumb instruction set is actually slower than the ARM one.

have you checked the results of your benchmark ? It seems really weird that changing the C library would so dramatically impact performance.

Koush said...

Yes, I checked the results of the benchmark and read more about Thumb shortly after posting this.
You are correct, Thumb IS supposed to be slower. So frankly, I have no idea why Mono is faster with Bionic's libc.