Quantcast

The Size of Executables

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

The Size of Executables

Bing Li
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?

Thanks,
LB

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The Size of Executables

Nic Wise
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.

so:

Obj-C -> GCC (or LLVM) -> ARM code

vrs MT:

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:

http://goo.gl/USPWn (website)
http://goo.gl/ePhKa (itunes link)

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
longer.






On Mon, Mar 21, 2011 at 08:41, Bing Li <[hidden email]> wrote:

> 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?
> Thanks,
> LB
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/ | http://www.flickr.com/photos/nicwise
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Loading...