21

I am considering using MonoTouch for some iPhone development, but payload size is an important factor.

For a user who has never installed Mono on their iPhone before, what would the size of an Objective-C "Hello World" app be compared to a MonoTouch "Hello World" app?

More specifically, what is the approx. number of bytes that need to be downloaded, and what is the approx. number of bytes used once installed?

3 Answers 3

17

A "Hello world" program in Objective-C occupies 50 KB (whole .app folder). With MonoTouch, a similar "Hello World" app occupies 5 MB (whole .app folder), which is not bad at all considering it has a runtime with garbage collection in it.

11
  • 1
    Apps are sent zipped to the app store, so count a 30 to 50% or so reduction in size for the download size. Once installed on the device, the app will take the same amount as the .app folder you built. Sep 18, 2009 at 18:31
  • 5
    Not correct Zoran. The zipped executable size is NOT what the appstore lists for size. One of our applications was under 10mb when zipped and uploaded, however it now shows as 14.7 in the store. This unfortunately puts us over the limit for 3g downloads.
    – Lounges
    Sep 18, 2009 at 18:33
  • 6
    5MB is HUGE! objc + GC on Mac OS X occupy less than 1.25MB. I'd bet most of that 5MB is the gluey goop between the Mono APIs and the Cocoa Touch APIs.
    – bbum
    Sep 18, 2009 at 19:34
  • 2
    I think it would be very smart for Apple to give some support to Mono Touch just like they did to Bootcamp: yes, people can easily install Windows on a Mac now, but that's the reason I got started on Mac! I bought one thinking I would probably drop it and just install Windows on it... I thought I wouldn't like OS X as much as I loved the hardware. 6 months later, I dropped Windows completely! Supporting Mono Touch could have similar benefits for Apple. I don't plan to use Mono Touch, but it's a fantastic thing to have. They should bundle the Mono runtime with each iPhone, starting at v4.0 Sep 20, 2009 at 1:16
  • 9
    The apps are not that big, I'm not sure where "5meg" comes from. Unless you include the entire monotouch API set, but most apps use an area only. I produce more apps and sell more apps and make more money now that I switched from XCode to Monotouch and in the end, that's the best benchmark for a commercial developer. Happy, paying customers and lots of them.
    – Ian Vink
    Feb 28, 2010 at 22:49
11

In 1.5 Monotouch

A release build - that is a an application built with a distribution license - and with nothing but the default project settings, is 5 MB. Of that 4.3 MB is the binary executable.

They often rise to up to 10 MB in my experience, and the forums paint the same picture. The appstore reports the unzipped size, however they are downloaded zipped. Zipped it is around 3 MB which, even on a 3G, is fine.

In my view, most people won't look at the filesize before downloading an app, nor particularly care. The appstore limit for 3G downloads is now 20 MB which is well within the MonoTouch size.

To play devil's advocate, yes, it is many orders bigger than the Objective-C equivalent and could scare off a few people worried about occupying 4-10 MB more of their 16 GB space. However there is also time to market and the existing tools available for .NET. I develop and build all my MonoTouch apps in Visual Studio 2010 then test them on the Mac, and I don't think even Apple would argue their IDE is close to the industry leader.

5
  • Hey, Chris -- I'm a bit frustrated with MonoDevelop and interested in the VS approach. Do you have a writeup anywhere on what you've found to be a good way to set that up? Or should I rephrase that as an SO question? :) Mar 10, 2011 at 19:04
  • 1
    @David I've got a small section on VS2010 at shrinkrays.net/code-snippets/csharp/… scroll down to "Using a monotouch project in Visual Studio 2008/2010"
    – Chris S
    Mar 11, 2011 at 12:29
  • Cool, thanks. Looks like I already bookmarked your page and didn't make the connection. :) Mar 11, 2011 at 16:59
  • @David Full howto: blog.binaryfinery.com/pages/…
    – jamie
    May 29, 2011 at 0:56
  • 2
    To anyone wanting to use Visual Studio 2010 with MonoTouch. Many of those workarounds involving hacking the cproj file and having to maintain two versions of the project and solution files have been made obsolete by this fantastic VS2010 addon: github.com/follesoe/VSMonoTouch Nov 23, 2011 at 11:43
8

From this question on MonoTouch and Size of Executables:

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

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

The answerer goes on to say that he feels that he is more productive with MonoTouch than Objective-C. YMMV.

1
  • @RedFilter: Wouldn't of known about it if it wasn't for Jeff Atwood pointing it out in a blog post.
    – user195488
    Jul 14, 2011 at 13:30

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.