xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.49k stars 515 forks source link

Improve default build times on arm64 #21444

Open rolfbjarne opened 1 month ago

rolfbjarne commented 1 month ago

The default build times for a Mac Catalyst app on arm64 are horrendous:

Enabling the trimmer or the interpreter makes it much better:

So I suggest we enable the trimmer by default for Debug mode on Mac Catalyst (this would match how we handle iOS and tvOS in the simulator + we don't enable the interpreter on any other platform).

The same thing happens for the iOS and tvOS Simulators as well.

tipa commented 2 weeks ago

In tests with my real-world apps, build + deploy times to the simulator are ~16 seconds when only specifying UseInterpreter and ~13-14 seconds when specifying both UseInterpreter & TrimMode=partial. Will this change yield similar results? I am asking because in the commit it says

Linking is on by default in the simulator when building for arm64, as long as the interpreter is not enabled

https://github.com/xamarin/xamarin-macios/blob/bc1ae55783c0e0ceb419e9b103b2b09201b9faf8/dotnet/targets/Xamarin.Shared.Sdk.Trimming.props#L57C1-L58C1

rolfbjarne commented 1 week ago

In tests with my real-world apps, build + deploy times to the simulator are ~16 seconds when only specifying UseInterpreter and ~13-14 seconds when specifying both UseInterpreter & TrimMode=partial. Will this change yield similar results? I am asking because in the commit it says

Linking is on by default in the simulator when building for arm64, as long as the interpreter is not enabled

bc1ae55/dotnet/targets/Xamarin.Shared.Sdk.Trimming.props#L57C1-L58C1

Yes, you should get some similar results (probably somewhere between 13 and 16 seconds).

It should be easy enough for you to try it, by building with "TrimMode=partial" (without setting UseInterpreter).

tipa commented 1 week ago

Only tested with one app, but the build & deploy time to simulator increased from 16 seconds to 21 seconds when removing UseInterpreter=false and using TrimMode=partial only