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

Size regression on win-x64 with managed objwriter #96665

Closed
am11 opened this issue Jan 9, 2024 · 5 comments · Fixed by #96686
Closed

Size regression on win-x64 with managed objwriter #96665

am11 opened this issue Jan 9, 2024 · 5 comments · Fixed by #96686
Assignees
Labels
area-NativeAOT-coreclr size-reduction Issues impacting final app size primary for size sensitive workloads

Comments

@am11
Copy link
Member

am11 commented Jan 9, 2024

On win-x64, the object size is smaller with managed implementation, but final executable size regresses.

> Set-Alias -Name dotnet9 -Value ~/.dotnet9/dotnet
> dotnet9 --version
9.0.100-alpha.1.24059.1

> dotnet9 new webapiaot -n web1
> cd web1

# managed
> dotnet9 publish -c Release -o dist
> wsl du -b dist/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9504768 dist/web1.exe
51874490        obj/Release/net9.0/win-x64/native/web1.obj

# native
> rm -r -fo obj
> $env:DOTNET_USE_LLVM_OBJWRITER="1"
> dotnet9 publish -c Release -o dist2
> wsl du -b dist2/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9241088 dist2/web1.exe
55142434        obj/Release/net9.0/win-x64/native/web1.obj
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 9, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 9, 2024
@am11 am11 added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 9, 2024
@ghost
Copy link

ghost commented Jan 9, 2024

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

On win-x64, the object size is smaller with managed implementation, but final executable size regresses.

> Set-Alias -Name dotnet9 -Value ~/.dotnet9/dotnet
> dotnet9 --version
9.0.100-alpha.1.24059.1

> dotnet9 new webapiaot -n web1
> cd web1

# managed
> dotnet9 publish -c Release -o dist
> wsl du -b dist/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9504768 dist/web1.exe
51874490        obj/Release/net9.0/win-x64/native/web1.obj

# native
> rm -r -fo obj
> $env:DOTNET_USE_LLVM_OBJWRITER="1"
> dotnet9 publish -c Release -o dist2
> wsl du -b dist2/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9241088 dist2/web1.exe
55142434        obj/Release/net9.0/win-x64/native/web1.obj
Author: am11
Assignees: -
Labels:

untriaged, area-NativeAOT-coreclr

Milestone: -

@am11
Copy link
Member Author

am11 commented Jan 9, 2024

cc @filipnavara

@filipnavara filipnavara self-assigned this Jan 9, 2024
@filipnavara
Copy link
Member

Thanks for filing it. I'll look into it soon.

@am11 am11 added the size-reduction Issues impacting final app size primary for size sensitive workloads label Jan 9, 2024
@ghost
Copy link

ghost commented Jan 9, 2024

Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

On win-x64, the object size is smaller with managed implementation, but final executable size regresses.

> Set-Alias -Name dotnet9 -Value ~/.dotnet9/dotnet
> dotnet9 --version
9.0.100-alpha.1.24059.1

> dotnet9 new webapiaot -n web1
> cd web1

# managed
> dotnet9 publish -c Release -o dist
> wsl du -b dist/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9504768 dist/web1.exe
51874490        obj/Release/net9.0/win-x64/native/web1.obj

# native
> rm -r -fo obj
> $env:DOTNET_USE_LLVM_OBJWRITER="1"
> dotnet9 publish -c Release -o dist2
> wsl du -b dist2/web1.exe obj/Release/net9.0/win-x64/native/web1.obj

9241088 dist2/web1.exe
55142434        obj/Release/net9.0/win-x64/native/web1.obj
Author: am11
Assignees: filipnavara
Labels:

untriaged, size-reduction, area-NativeAOT-coreclr

Milestone: -

@filipnavara
Copy link
Member

filipnavara commented Jan 9, 2024

Preliminary examination seems to be that the difference is the .rdata section of the executable. The .rdata sections in the source .obj files have identical size. There's multiple .rdata sections with COMDAT symbols so it's possible that some folding is not taking place while it should. However, the regression is more likely to come from the .xdata (exception data) section which happens to be bigger in the .obj file produced by the managed code. I'll check that.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jan 9, 2024
@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels Jan 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr size-reduction Issues impacting final app size primary for size sensitive workloads
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants