Open
Description
Throughout the .NET 9 development cycle, the iOS HelloWorld Mono size measurements recorded several regressions related to BCL changes:
Regression | PR* | Size |
---|---|---|
#93072 | #90764 | - |
#101488 | #101258 | 0.29 MB |
#100975 | #99982 | 1.40 MB |
#104073 | #101196 | 0.12 MB |
#104952 | #103837 | 0.64 MB |
The common denominator of the changes was introduction of new generic APIs. I investigated a bit the impact of generic vs specialized API on the iOS app size using an dotnet new ios
sample app and simple generic vs specialized interface.
Generic | Specialized |
---|---|
interface IFace {
void foo<T> (T t);
}
class Class1 : IFace {
public virtual void foo<T> (T t) {
Console.WriteLine ("Class1.foo<T> called with " + t);
}
} |
interface IFace {
void foo (int t);
void foo (string t);
}
class Class1 : IFace {
public void foo (int t) {
Console.WriteLine ("Class1.foo<int> called with " + t);
}
public void foo (string t) {
Console.WriteLine ("Class1.foo<string> called with " + t);
}
} |
The preliminary conclusion is that generics API don't bring increase in app size over the specialized API. The results were ~ identical for both apps.
The issue could be to be related to Mono not being able to trim out the newly introduced BCL APIs even though they are not used by the iOS app.
Tested on 9.0.100-preview.5.24307.3
- The marked PR are selected as the most likely root cause from the regression range. Only in some cases the regression PR was confirmed by manual verification