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

Do less work when resolving members of types #79784

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Dec 17, 2022

When constructing type system representation of a type member, we need two things - the token of the member, and type system representation of the owning type.

We have a couple places where we iterate members on a type - in those places, we already have a type system representation of the owning type. Shortcut the codepath that would recompute this information. This avoids finding the parent token of the token in metadata (this is an $O(log(N))$ operation) and the type system representation of the parent token (a hash table lookup, so $O(1)$ operation).

This kicks in quite often because a lot of EcmaMethods are materialized as part of virtual method resolution when we iterate all virtual methods on a type.

Cc @dotnet/ilc-contrib

When constructing type system representation of a type member, we need two things - the token of the member, and type system representation of the owning type.

We have a couple places where we iterate members on a type - in those places, we already have a type system representation of the owning type. Shortcut the codepath that would recompute this information.
@ghost
Copy link

ghost commented Dec 17, 2022

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

Issue Details

When constructing type system representation of a type member, we need two things - the token of the member, and type system representation of the owning type.

We have a couple places where we iterate members on a type - in those places, we already have a type system representation of the owning type. Shortcut the codepath that would recompute this information. This avoids finding the parent token of the token in metadata (this is an $O(log(N))$ operation) and the type system representation of the parent token (a hash table lookup, so $O(1)$ operation).

This kicks in quite often because a lot of EcmaMethods are materialized as part of virtual method resolution when we iterate all virtual methods on a type.

Cc @dotnet/ilc-contrib

Author: MichalStrehovsky
Assignees: MichalStrehovsky
Labels:

area-crossgen2-coreclr, area-NativeAOT-coreclr

Milestone: -

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Nice!

@jkotas jkotas merged commit 01b57cc into dotnet:main Dec 17, 2022
@MichalStrehovsky MichalStrehovsky deleted the fasterresolve branch December 17, 2022 21:53
@ghost ghost locked as resolved and limited conversation to collaborators Jan 17, 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.

2 participants