Proposal: Trimming configuration with System.Private.CoreLib ReadyToRun compiled
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
Today when an app is published trimmed the runtime libraries are not ReadyToRun compiled. This can cause significant startup penalties compared to non-trimmed configurations where the runtime is R2R compiled. It also seems unexpected that going from self-contained to self-contained+trimmed would cause a significant slowdown.
Full R2R compilation is usually too large is trimming is required, but we could R2R just System.Private.CoreLib. This would add a small size penalty (~3-6mb depending on what's trimmed) but would restore a significant amount of startup speed. For example, Azure MCP sees ~20% increase in startup for time to first response by R2R'ing CoreLib.
This is possible now with a custom MSBuild target that sets the `PublishReadyToRunExclude` item group, but we could expose a property that sets up this configuration.
Contributor guide
Assessment
This issue has not been assessed yet.