using statements vs fully qualified names - any difference to performance/ipa and apk size?

amirvenusamirvenus USMember ✭✭✭

Hi guys,

I have a relatively simple XF project that uses the PayPal SDK for Xamarin.Forms to collect payments.

The problem is that the size is around 120MB on iOS and 65MB on Android which I believe is way too much considering that I am using LLVM and Link All options.

Now, I am trying to explore all possible ways to shrink the app size as much as possible so I can compete with real native apps that offer the same functionality but are sizes less than 20MB!

One of the things I noticed as well is that Linker doesn't do much for me as when I disabled it, the increase in size was only 10MB!

My question is would it be better to use fully qualified names instead of using statements on top of the class?

System.IO.File.ReadAllLines or File.ReadAllLines (with using System.IO at top)?

Answers

  • batmacibatmaci DEMember ✭✭✭✭✭

    you can use proguard. it helps to decrease the size but you should be careful with testing. use also settings like in this article
    https://xamarinhelp.com/reducing-app-file-size-xamarin-forms/

  • amirvenusamirvenus USMember ✭✭✭

    @batmaci said:
    you can use proguard. it helps to decrease the size but you should be careful with testing. use also settings like in this article
    https://xamarinhelp.com/reducing-app-file-size-xamarin-forms/

    I think you didn't read the question very well!

    I am asking whether to use System.IO.File.ReadAllLines or File.ReadAllLines (with using System.IO at top)?

  • batmacibatmaci DEMember ✭✭✭✭✭
    edited April 17
    Do you think that if you use using statement it includes entire namespace into your package instead of the function you access? I don't think so that it makes difference.
  • amirvenusamirvenus USMember ✭✭✭

    @batmaci said:
    Do you think that if you use using statement it includes entire namespace into your package instead of the function you access? I don't think so that it makes difference.

    That's exactly my question. Does it or does it not?

  • RHudsonRHudson CAMember ✭✭✭
    edited April 18

    @amirvenus

    I don't see what possible difference this can make. You'll get the exact same IL code either way.

  • amirvenusamirvenus USMember ✭✭✭

    And does it not make any difference to the Linker as well when using Link All option?

  • yelinzhyelinzh Member, Xamarin Team Xamurai

    There is no difference between using command and qualified class name. Changes to package size caused by using command can be ignored.

Sign In or Register to comment.