xamarin-macios icon indicating copy to clipboard operation
xamarin-macios copied to clipboard

[net10.0] Trim by default (SdkOnly) when building for arm64. Fixes #21444.

Open rolfbjarne opened this issue 1 year ago • 12 comments

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

  • dotnet new maccatalyst && dotnet build: 1 minute

Enabling the trimmer or the interpreter makes it much better:

  • dotnet new maccatalyst && dotnet build /p:UseInterpreter: 17 seconds
  • dotnet new maccatalyst && dotnet build /p:TrimMode=partial: 12 seconds
  • dotnet new maccatalyst && dotnet build /p:TrimMode=full: 12 seconds
  • dotnet new maccatalyst && dotnet build /p:TrimMode=partial /p:UseInterpreter=true: 12 seconds

So enable the trimmer by default for Debug mode on ARM64 on:

  • iOS
  • tvOS
  • Mac Catalyst

(we're already trimming for other build configurations, so it seemed like an easy to choice to enable the trimmer in these configurations as well, as opposed to enabling the interpreter)

Fixes https://github.com/xamarin/xamarin-macios/issues/21444.

rolfbjarne avatar Oct 16 '24 20:10 rolfbjarne

:computer: [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed :computer:

:white_check_mark: All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:computer: [CI Build] Tests on macOS M1 - Mac Monterey (12) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:computer: [CI Build] Tests on macOS M1 - Mac Ventura (13) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:white_check_mark: API diff for current PR / commit

.NET (No breaking changes)

:white_check_mark: API diff vs stable

.NET (No breaking changes)

:information_source: Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:computer: [CI Build] Windows Integration Tests passed :computer:

:white_check_mark: All Windows Integration Tests passed.

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:fire: [CI Build] Test results :fire:

Test results

:x: Tests failed on VSTS: test results

0 tests crashed, 4 tests failed, 101 tests passed.

Failures

:x: dotnettests tests (MacCatalyst)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

:x: monotouch tests (macOS)

1 tests failed, 12 tests passed.
  • monotouch-test/Mac Catalyst [dotnet]/Debug (ARM64) [dotnet]: BuildFailure

Html Report (VSDrops) Download

:x: monotouch tests (tvOS)

2 tests failed, 7 tests passed.
  • monotouch-test/tvOS - simulator/Debug (managed static registrar) [dotnet]: Failed
  • monotouch-test/tvOS - simulator/Release (managed static registrar, all optimizations) [dotnet]: Failed

Html Report (VSDrops) Download

Successes

:white_check_mark: cecil: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: framework: All 2 tests passed. Html Report (VSDrops) Download :white_check_mark: fsharp: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: generator: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: introspection: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: linker: All 40 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (iOS): All 7 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (MacCatalyst): All 8 tests passed. Html Report (VSDrops) Download :white_check_mark: msbuild: All 2 tests passed. Html Report (VSDrops) Download :white_check_mark: xcframework: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent Hash: bc1ae55783c0e0ceb419e9b103b2b09201b9faf8 [PR build]

:computer: [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed :computer:

:white_check_mark: All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

:white_check_mark: API diff for current PR / commit

.NET (No breaking changes)

:white_check_mark: API diff vs stable

.NET (No breaking changes)

:information_source: Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

:computer: [CI Build] Tests on macOS M1 - Mac Ventura (13) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

:computer: [CI Build] Tests on macOS M1 - Mac Monterey (12) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

:computer: [CI Build] Windows Integration Tests passed :computer:

:white_check_mark: All Windows Integration Tests passed.

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

:rocket: [CI Build] Test results :rocket:

Test results

:white_check_mark: All tests passed on VSTS: test results.

:tada: All 99 tests passed :tada:

Tests counts

:white_check_mark: cecil: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: framework: All 2 tests passed. Html Report (VSDrops) Download :white_check_mark: fsharp: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: generator: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: introspection: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: linker: All 40 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (iOS): All 7 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (MacCatalyst): All 8 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download :white_check_mark: monotouch (tvOS): All 7 tests passed. Html Report (VSDrops) Download :white_check_mark: msbuild: All 2 tests passed. Html Report (VSDrops) Download :white_check_mark: xcframework: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent Hash: d3992850f5d9099c9e9ae92e8c8234299267c83d [PR build]

Does this have any side-effect for Hot Reload?

Hot Reload already works on iOS device, where we're already trimming by default. This means that if Hot Reload requires trimming to be disabled, then it's already disabling it - so unless Hot Reload is disabling trimming exclusively for device builds, which would be a weird thing to do, it should continue to work fine (famous las words!)

rolfbjarne avatar Oct 23 '24 19:10 rolfbjarne

MAUI disables trimming for both iOS and Mac Catalyst as long as the project is building for Debug:

https://github.com/dotnet/maui/blob/4c75db4795b8abbc810eae4c7f4acc9ac2e2e24a/src/Controls/src/Build.Tasks/nuget/buildTransitive/net6.0-ios10.0/Microsoft.Maui.Controls.iOS.targets#L4

https://github.com/dotnet/maui/blob/4c75db4795b8abbc810eae4c7f4acc9ac2e2e24a/src/Controls/src/Build.Tasks/nuget/buildTransitive/net6.0-maccatalyst13.1/Microsoft.Maui.Controls.MacCatalyst.targets#L4

So I believe this should be fine with regards to Hot Reload.

rolfbjarne avatar Oct 23 '24 19:10 rolfbjarne

CC @Redth for awareness

rolfbjarne avatar Oct 23 '24 19:10 rolfbjarne