6

I created a small application in Delphi XE4 for iOS. I have 7 forms on it. And everything is good.

But I am a little bit shocked with file size! Its 44MB on Simulator. The same application I made for android was almost 2MB. It has a background image which is 320kb in jpg format I didn't test it on IPhone device yet!

What is the normal size application if you create on XCode with ListBox, texts, buttons on the forms?

Is there a way to decrease the filesize by changing any settings in Delphi?

Peter
  • 2,977
  • 1
  • 17
  • 29
Barlet
  • 545
  • 2
  • 8
  • 26
  • Did you try when targeting iOS ARM in release mode? It should be must smaller. Newer versions of Delphi are known to add a lot of content to the .Exe, including RTTI and debug information. – Arnaud Bouchez Jul 19 '13 at 17:31
  • This does not seem right. I have full app XE3 with over 300 forms, DevExpress and other VCL and the size is 45MB. IOS apps should be smaller! – ZibNimer Jul 19 '13 at 17:58

3 Answers3

17

Around 15 MB sounds to be the smallest executable size with Delphi for iOS (in Release mode with no debug info). You can try to disable the RTTI generation, if you do not need it. But not with a lot of hope.

It is much bigger than ObjectiveC "native", but it embeds the whole Delphi RTL and the FireMonkey libraries to do all the rendering, therefore it is bigger.

A "plain Objective Pascal" executable using native iOS controls, compiled with FPC, should be smaller. Or when compiled with "Oxygene for Cocoa", it should be much smaller.

But do not look only at executable size, think at the memory used during execution, and general speed. You may have to compare with HTML5 apps embedded with PhoneGap. FireMonkey may be slower at rendering on screen, but native code with ARC memory handling should be more powerful than JavaScript.

Do not forget that your smartphone has now a lot of memory. ;)

Sadly, it is not possible to share some code with external libraries (.so) under iOS, so you won't be able to use something like Delphi packages to reduce the executable size.

Of course, Apple has always done everything in its power to force developers to use its own tools and language. As does Microsoft, especially for Windows 8. Delphi for iOS does not claim to be better than XCode + Objective C, but to be cross platform so that you can share as much code as possible with your server or Windows / Mac OSX apps: you can not use your Objective C code outside the Mac world... but you can share your Delphi code among platforms, even if the UI has to be rewritten for mobiles. This is why a more fair comparison would be with JavaScript/PhoneGap, MonoDroid/MonoTouch or AppCelerator.

Some data, retrieved from StackOverflow:

One concern: AFAIK the size limit for 3G download in the AppStore is about 20 MB.

Community
  • 1
  • 1
Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • Size is really important if the delivery is via app store over the air download – David Heffernan Jul 20 '13 at 07:03
  • @DavidHeffernan But if you want your application to be downloaded by everyone, a dedicated version in XCode/ObjectiveC is worth it. If you want your application to be part of a proprietary system, Delphi for iOS will help you reduce the cost by re-use code and knowledge. I mean, we do not have to miss the target. – Arnaud Bouchez Jul 20 '13 at 07:10
  • I found an application that is made in Delphi and its only 11MB. When I create plain application nothing on it and only 1 form I have 35mb. Next week I will buy Apple Developer Account and will generate IPA file. Maybe when building IPA file size reduces... – Barlet Jul 21 '13 at 15:45
  • Size is very very important. Not only initial download, but every update will download the whole app. 15 MB is not small in mobile world. Also even if the phones do have more RAM and storage, 15 MB is not so innocent. I can find some articles that warn about memory. – Runner Sep 19 '13 at 17:14
  • 1
    I just found out [how to create small apps for iPhone and Android using FPC with native UI components](http://blog.synopse.info/post/2013/09/19/FreePascal-Lazarus-and-Android-Native-Controls). For Android, it creates only 140 KB .APK files! – Arnaud Bouchez Sep 20 '13 at 05:20
  • @A. Bouchez, nice. Will have a look. – Runner Sep 20 '13 at 05:58
0

To add to Arnaud's answer:

You can use Native controls instead of the Firemonkey ones.
Babak Yaghoobi has written a library to let Delphi use the OS's native controls.

See here for iOS: http://sourceforge.net/projects/dpfdelphiios/files/?source=navbar
And here for Android: http://sourceforge.net/projects/dpfdelphiandroid/

Firemonkey renders using 100% Delphi code, the native controls use the internal code in your phone's ROM.

Johan
  • 74,508
  • 24
  • 191
  • 319
  • YOu still need to embed the rest of the FireMonkey libraries though for the controls that aren't native (i.e. TForm). If you're going to those lengths, just ditch Delphi and go fully native if it bothers you that much. Size is important, but heck, the Facebook App is 70 odd mb. – Steve Childs Apr 17 '15 at 13:40
  • @SteveChilds If a class is not used, its code is stripped out of the executable, due to dead code removal. So your comment is incorrect. – Johan Apr 17 '15 at 14:58
0

We have an iOS application with 6 forms and many controls. The release ipa clocks in just over 11 mb and that includes all of those required application icons (28 total measuring a little over 1 mb).

In my opinion, that is not that large so I do not see an issue here.

t j
  • 413
  • 1
  • 7
  • 12