KEMBAR78
Do not generate Equals/GetHashCode support for async state machines by MichalStrehovsky · Pull Request #83369 · dotnet/runtime · GitHub
Skip to content

Conversation

MichalStrehovsky
Copy link
Member

Saves 0.63% on BasicMinimalApi.

This logic controls whether we inject the __GetFieldHelper override for the type (see dotnet/corert#5436). Suggestions for better ways of detecting async state machines are welcome!

Context: #83323

Cc @dotnet/ilc-contrib

Saves 0.63% on BasicMinimalApi.

This logic controls whether we inject the `__GetFieldHelper` override for the type (see dotnet/corert#5436).
@ghost
Copy link

ghost commented Mar 14, 2023

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

Issue Details

Saves 0.63% on BasicMinimalApi.

This logic controls whether we inject the __GetFieldHelper override for the type (see dotnet/corert#5436). Suggestions for better ways of detecting async state machines are welcome!

Context: #83323

Cc @dotnet/ilc-contrib

Author: MichalStrehovsky
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@jkotas
Copy link
Member

jkotas commented Mar 14, 2023

Are these more things that can be stripped from async state machines? I assume that we block reflection for them already.

@MichalStrehovsky
Copy link
Member Author

Are these more things that can be stripped from async state machines? I assume that we block reflection for them already.

No, they're eligible for reflection... except for CoreLib and the other System.Private libraries. We don't block private reflection anywhere else right now.

One thing we could do is try to make their MethodTable smaller. Currently we need to set several bits in optional fields and rare flags... that are not so rare because there's many of these.

The interface implementations also go to the sealed vtable. Not sure if there's big advantages to that.

@MichalStrehovsky
Copy link
Member Author

Are these more things that can be stripped from async state machines? I assume that we block reflection for them already.

No, they're eligible for reflection... except for CoreLib and the other System.Private libraries. We don't block private reflection anywhere else right now.

One thing we could do is try to make their MethodTable smaller. Currently we need to set several bits in optional fields and rare flags... that are not so rare because there's many of these.

The interface implementations also go to the sealed vtable. Not sure if there's big advantages to that.

Looked more into it.

Making these reflection blocked would save 0.04%. We'd also not get much saving from making the MethodTables smaller. There's only 250 state machines in BasicMinimalApi so saving ~20 bytes per each of these wouldn't be meaningful. These GetFieldHelper methods are often 200-300 bytes of overhead so the savings are more pronounced.

@MichalStrehovsky MichalStrehovsky merged commit 2b1c1e2 into dotnet:main Mar 14, 2023
@MichalStrehovsky MichalStrehovsky deleted the asyncopt branch March 14, 2023 08:21
@ghost ghost locked as resolved and limited conversation to collaborators Apr 13, 2023
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.

3 participants