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

Optimized/fixed TypeLocator.GetGenericInterfaceImplementation #857

Merged
merged 1 commit into from
Oct 13, 2020
Merged

Optimized/fixed TypeLocator.GetGenericInterfaceImplementation #857

merged 1 commit into from
Oct 13, 2020

Conversation

bart-degreed
Copy link
Contributor

This method was identified as a hot path in profiling JsonApiDotNetCoreExample tests.

Type.GetGenericTypeDefinition() on the incoming parameter was called inside the loop, which is unneeded. And it compared generic type parameters before looking at the type itself, potentially evaluating too much.

This change makes it run 30% faster. This change also improves input validation and fixes the bug where only the first type parameter was matched against found types.

This method was identified as a hot path in profiling JsonApiDotNetCoreExample tests.

Type.GetGenericTypeDefinition() on the incoming parameter was called inside the loop, which is unneeded. And it compared generic type parameters before looking at the type itself, potentially evaluating too much.

This change makes it run 30% faster. This change also improves input validation and fixes the bug where only the first type parameter was matched against found types.
@maurei maurei merged commit d043619 into json-api-dotnet:master Oct 13, 2020
@bart-degreed bart-degreed deleted the assembly-scanning branch October 13, 2020 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants