Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[illink] Try to reduce/eliminate System.Linq usage #5442

Closed
radekdoulik opened this issue Dec 18, 2020 · 0 comments · Fixed by #7210
Closed

[illink] Try to reduce/eliminate System.Linq usage #5442

radekdoulik opened this issue Dec 18, 2020 · 0 comments · Fixed by #7210

Comments

@radekdoulik
Copy link
Member

Lets try to replace System.Linq usage and see what will be the effect on apk size

@radekdoulik radekdoulik self-assigned this Dec 18, 2020
@radekdoulik radekdoulik added this to the One .NET milestone Dec 18, 2020
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this issue Dec 18, 2020
Context: dotnet#5442

Apk size of BuildReleaseArm64False/net6 comparison:

    apkdiff --bs -e dll$ before.apk after.apk
    Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
      +         274 assemblies/Mono.Android.dll
        Type Android.Runtime.AndroidTypeManager
          -          42 Method System.Collections.Generic.IEnumerable`1<System.Type> GetTypesForSimpleReference (string)
          -          33 Method public void RegisterNativeMembers (Java.Interop.JniType, System.Type, string)
          +             Method System.Collections.Generic.IEnumerable`1<System.Type> <>n__0 (string)
          -             Type <>c__DisplayClass11_0
          -             Type <>c__DisplayClass11_1
          +             Type <GetTypesForSimpleReference>d__2
      -          67 assemblies/System.Private.CoreLib.dll
        Type System.Array
          -             Method public static void Fill (!!T[], !!T)
      -         424 assemblies/System.Linq.dll
        Type System.Linq.Enumerable
          -             Method public static System.Collections.Generic.IEnumerable`1<!!TResult> Repeat (!!TResult, int)
          -             Type RepeatIterator`1<TResult>
        Type System.Linq.ThrowHelper
          -             Method static void ThrowArgumentOutOfRangeException (System.Linq.ExceptionArgument)
    Summary:
      -         217 Assemblies -0.03% (of 782,054)
jonpryor pushed a commit that referenced this issue Dec 18, 2020
Context: #5442

Apk size of BuildReleaseArm64False/net6 comparison:

    apkdiff --bs -e dll$ before.apk after.apk
    Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
      +         274 assemblies/Mono.Android.dll
        Type Android.Runtime.AndroidTypeManager
          -          42 Method System.Collections.Generic.IEnumerable`1<System.Type> GetTypesForSimpleReference (string)
          -          33 Method public void RegisterNativeMembers (Java.Interop.JniType, System.Type, string)
          +             Method System.Collections.Generic.IEnumerable`1<System.Type> <>n__0 (string)
          -             Type <>c__DisplayClass11_0
          -             Type <>c__DisplayClass11_1
          +             Type <GetTypesForSimpleReference>d__2
      -          67 assemblies/System.Private.CoreLib.dll
        Type System.Array
          -             Method public static void Fill (!!T[], !!T)
      -         424 assemblies/System.Linq.dll
        Type System.Linq.Enumerable
          -             Method public static System.Collections.Generic.IEnumerable`1<!!TResult> Repeat (!!TResult, int)
          -             Type RepeatIterator`1<TResult>
        Type System.Linq.ThrowHelper
          -             Method static void ThrowArgumentOutOfRangeException (System.Linq.ExceptionArgument)
    Summary:
      -         217 Assemblies -0.03% (of 782,054)
@jonathanpeppers jonathanpeppers modified the milestones: .NET 6, .NET 7 Jun 14, 2021
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Jul 27, 2022
Fixes: dotnet#5442

Remove all `using System.Linq` statements and all use of LINQ
extension methods from `Mono.Android.dll`.

Primary motivation was to reduce `.apk` size (09baa52), and we don't
want to inadvertently allow LINQ usage back in…
jonpryor added a commit that referenced this issue Jul 27, 2022
Fixes: #5442

Remove all `using System.Linq` statements and all use of LINQ
extension methods from `Mono.Android.dll`.

Primary motivation was to reduce `.apk` size (09baa52), and we don't
want to inadvertently allow LINQ usage back in…
@ghost ghost locked as resolved and limited conversation to collaborators Aug 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants