Skip to content

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented May 17, 2024

This property does not do what its name says. The symbols are generated regardless of whether this property is true or false. What this property actually does is that it disables C# peephole IL optimizations.

This change results in ~0.5% IL binary size improvement thanks to the Roslyn IL peephole optimizations that it enables. Also, this gets us closer to default build configuration used by our users.

@jkotas jkotas added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it area-Infrastructure-libraries labels May 17, 2024
@jkotas jkotas changed the title Delete DebugSymbols Delete DebugSymbols property May 17, 2024
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas closed this May 17, 2024
@jkotas jkotas reopened this May 17, 2024
@jkotas jkotas closed this May 17, 2024
@jkotas jkotas reopened this May 17, 2024
@jkotas jkotas changed the title Delete DebugSymbols property Delete DebugSymbols=true setting for the repo build May 18, 2024
@jkotas jkotas removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it labels May 18, 2024
@jkotas
Copy link
Member Author

jkotas commented May 18, 2024

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member Author

jkotas commented May 18, 2024

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member Author

jkotas commented May 18, 2024

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member Author

jkotas commented May 18, 2024

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@am11
Copy link
Member

am11 commented May 19, 2024

This property does not do what its name says. The symbols are generated regardless of whether this property is true or false. What this property actually does is that it disables C# peephole IL optimizations.

https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022 documents DebugSymbols as:

Setting -p:DebugSymbols=false on the command line disables generation of program database (.pdb) symbol files.

Does it mean documentation is incorrect or it's in fact an accidental bug?

@jkotas
Copy link
Member Author

jkotas commented May 19, 2024

Does it mean documentation is incorrect or it's in fact an accidental bug?

I have opened dotnet/sdk#41364

My conclusion after reading through mentions of DebugSymbols property in dotnet/sdk repo is that it is a legacy mess that that should be avoided. DebugType property is what actually works.

This property does not do what its name says. The symbols are generated regardless of whether this property is true or false. What this property actually does is that it disables C# peephole IL optimizations.

This change results in ~0.5% IL binary size improvement thanks to the Roslyn IL peephole optimizations that it enables.
@jkotas jkotas marked this pull request as ready for review May 20, 2024 02:47
@jkotas jkotas requested a review from MichalStrehovsky as a code owner May 20, 2024 02:47
Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Co-authored-by: Michal Strehovský <[email protected]>
@ViktorHofer
Copy link
Member

For others reviewing this, the Microsoft.NET.Sdk makes this property still default to true when doing a Debug configuration build: https://github.com/dotnet/sdk/blob/ace21a69999eede779921900fca9420d37395aee/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props#L49

@jkotas jkotas merged commit 153a94b into dotnet:main May 21, 2024
@jkotas jkotas deleted the debugsymbols branch May 21, 2024 15:15
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* Delete DebugSymbols

This property does not do what its name says. The symbols are generated regardless of whether this property is true or false. What this property actually does is that it disables C# peephole IL optimizations.

This change results in ~0.5% IL binary size improvement thanks to the Roslyn IL peephole optimizations that it enables.

* Update eng/illink.targets

Co-authored-by: Michal Strehovský <[email protected]>

---------

Co-authored-by: Michal Strehovský <[email protected]>
@sbomer
Copy link
Member

sbomer commented May 30, 2024

Based on #102392 (comment), should DebugSymbols=true also be removed from the SDK when building the Debug configuration, or is disabling some peephole optimizations useful for debugging?

@jkotas
Copy link
Member Author

jkotas commented May 30, 2024

Possibly. It depends on whether and how the behavior of DebugSymbols is changed: dotnet/sdk#41364

@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants