It is said that the size of executables on iPhone or iPad is larger using MonoTouch than the one using Objective-C. Is it true? If MonoTouch can translate C# to Objective-C, the size should not be too large, right?
MonoTouch doesn't translate to Obj-c. It compiles to .NET IL, then
compiles that (in the same way a JIT compiler would, but before it's
run - hence "ahead of time" compiler) into native ARM code.
Obj-C -> GCC (or LLVM) -> ARM code
C# -> IL -> (AOT compiler) -> ARM code
I believe the AOT compiler in MT 3.x is something they derived from
the ARM port of Mono, where as the one in MT 4.x (in alpha) is based
on LLVM, so I guess they wrote a IL -> LLVM compiler / translator, and
then leveraged the same LLVM -> ARM layer that XCode uses (Apple has
standarized, mostly, on LLVM in XCode 4 - XCode 3.x was all GCC)
The output binaries in 3.x are larger because you are also including a
lot of the .NET framework (well, Mono Framework, but same-same), so if
you, for eg, use System.Xml, it has to include that into the output -
same with System.dll etc. The linker is pretty smart, but the output
binaries are always going to be larger.
For me, the only size thing that matters is load time, and zipped
binary size. Zipped binary for a "hello world" app is about 2.5-3meg
(smaller in 4.x I'm told) vrs about 300k for obj-c. The difference
gets less and less the more you add, as it only includes the likes of
system.dll once. Load time for MT vrs Obj-c, doing the same things at
the same time, is close enough to the same. Either one can be made to
load slowly (just do something long running in your FinishedLaunching
without putting it on another thread).
However, while the app is bigger and may load, in theory anyway,
slower, I find I'm 5x-10x more productive with MT, so I can get apps
out in a LOT shorter time than I could with Obj-C. eg this app:
took 2 weeks, part time (I was on holiday in New Zealand at the time,
and it was over new years - I was only working in it maybe every
second evening + around 2 full days at the end to polish it), from
opening monodevelop with an idea, to pushing it to the appstore.
MonoTouch.Dialog helped a lot too, but without MT, it'd take a lot lot
> Hi, all,
> It is said that the size of executables on iPhone or iPad is larger using
> MonoTouch than the one using Objective-C. Is it true? If MonoTouch can
> translate C# to Objective-C, the size should not be too large, right?
> MonoTouch mailing list
> [hidden email] > http://lists.ximian.com/mailman/listinfo/monotouch >