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

First round of trimming annotation work #29095

Merged
merged 1 commit into from
Sep 15, 2022
Merged

Conversation

roji
Copy link
Member

@roji roji commented Sep 14, 2022

To make basic save/query scenarios work with aggressive trimming, as long as user types are properly preserved. This is a conservative/safe wave of annotations that generally avoids risky suppressions; many warnings are still emitted by the linker, but basic scenarios still work. I've kept non-annotation code changes to a minimum, but I did some simple ones were done.

Here are some details and numbers; all scenarios were executed with the modified trimming tests we run in CI.

Trimming mode EF size Total publish dir size Notes
No trimming 4588kb 93MB
Partial 4588kb 54MB Default before 7.0, ASP.NET default in 7.0
Aggressive (before this PR) 380kb 34MB Application fails.
Aggressive (after this PR) 3384kb 34MB Console app default starting with 7.0. Application works.

To summarize, aggressive trimming mode cuts down 1204kb of pure EF size, totalling a 26% reduction in size. Precise per-assembly sizes are listed below.

EF sizes without trimming
28      Microsoft.EntityFrameworkCore.Abstractions.dll
24      Microsoft.EntityFrameworkCore.Analyzers.dll
2144    Microsoft.EntityFrameworkCore.dll
1904    Microsoft.EntityFrameworkCore.Relational.dll
488     Microsoft.EntityFrameworkCore.SqlServer.dll
4588    total
EF sizes after aggressive trimming (before this PR)
8       Microsoft.EntityFrameworkCore.Abstractions.dll
220     Microsoft.EntityFrameworkCore.dll
116     Microsoft.EntityFrameworkCore.Relational.dll
36      Microsoft.EntityFrameworkCore.SqlServer.dll
380     total
EF sizes after aggressive trimming (after this PR)
12      Microsoft.EntityFrameworkCore.Abstractions.dll
1636    Microsoft.EntityFrameworkCore.dll
1432    Microsoft.EntityFrameworkCore.Relational.dll
304     Microsoft.EntityFrameworkCore.SqlServer.dll
3384    total

Closes #29092

/cc @DamianEdwards after this, the TrimmedTodo console sample in https://github.com/DamianEdwards/TrimmedTodo works in .NET 7.0 even without specifying partial trimming.

@roji roji requested a review from a team September 14, 2022 15:29
To make basic save/query scenarios work with aggressive trimming, as
long as user types are properly preserved.

Closes dotnet#29092
@roji roji merged commit 2df08af into dotnet:release/7.0 Sep 15, 2022
@roji roji deleted the Trimming branch September 15, 2022 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make basic EF scenarios work under aggressive trimming
2 participants