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

Speed up cost of reflection a bit #28

Merged
merged 5 commits into from
Aug 4, 2017

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Aug 4, 2017

We cache the result of reflection at a few easy places.

More can certainly be done here and will be included in subsequent PRs.

I also take the opportunity to fix Equals and GetHashCode methods in light of the dual mode (metadata token vs. actual Reflection info object).

Besides being unused, the PropertyDesc was broken because it pointed at itself.
This also gives MethodRef the ability to represent constructors.
@AArnott AArnott self-assigned this Aug 4, 2017
@AArnott AArnott requested a review from AlexEyler August 4, 2017 01:44
@msftclas
Copy link

msftclas commented Aug 4, 2017

@AArnott,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@codecov-io
Copy link

Codecov Report

Merging #28 into master will decrease coverage by 0.14%.
The diff coverage is 75.4%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   83.06%   82.91%   -0.15%     
==========================================
  Files          72       72              
  Lines        5561     5606      +45     
  Branches      853      875      +22     
==========================================
+ Hits         4619     4648      +29     
- Misses        711      716       +5     
- Partials      231      242      +11
Impacted Files Coverage Δ
...t.VisualStudio.Composition/Reflection/FieldDesc.cs 0% <ø> (ø) ⬆️
...ft.VisualStudio.Composition/Reflection/TypeDesc.cs 0% <ø> (ø) ⬆️
...alStudio.Composition/Reflection/ConstructorDesc.cs 0% <ø> (ø) ⬆️
....VisualStudio.Composition/Reflection/MethodDesc.cs 0% <ø> (ø) ⬆️
...isualStudio.Composition/Reflection/PropertyDesc.cs 0% <ø> (ø) ⬆️
....VisualStudio.Composition/Reflection/MemberDesc.cs 0% <ø> (ø) ⬆️
...isualStudio.Composition/ExportDefinitionBinding.cs 73.52% <100%> (ø) ⬆️
...oft.VisualStudio.Composition/Reflection/TypeRef.cs 85.48% <100%> (ø) ⬆️
...t.VisualStudio.Composition/Reflection/MemberRef.cs 58.82% <100%> (+0.61%) ⬆️
...oft.VisualStudio.Composition/RuntimeComposition.cs 89.84% <100%> (ø) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1dc481...c92f295. Read the comment docs.

@@ -182,32 +178,9 @@ public static MemberInfo Resolve(this MemberRef memberRef)
throw new NotSupportedException();
}

[Obsolete("Use " + nameof(MemberRef) + " instead.", error: true)]
public static MemberInfo Resolve(this MemberDesc memberDesc)
Copy link
Member Author

Choose a reason for hiding this comment

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

This method was always just broken. And we never used it. So rather than fix it (which would require a breaking change), since it was never used I just scrape out its implementation. I'll remove these broken and unused types in v16.

@AArnott AArnott merged commit 44cf565 into master Aug 4, 2017
@AArnott AArnott deleted the dev/andarno/fasterSlowReflection branch August 4, 2017 20:16
AArnott added a commit that referenced this pull request Jun 7, 2022
AArnott added a commit that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants