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

Add caching to DefaultTypeResolver (issue #437) #447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adambajguz
Copy link

Description

Adds a cache to DefaultTypeResolver

Fixes #437

How Has This Been Tested?

Run all tests defined in the project

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

$"{messageType.FullName}, {messageType.Assembly.GetName().Name}");
string messageTypeName = ProduceTypeCache.GetOrAdd(
messageType,
static messageType => $"{messageType.FullName}, {messageType.Assembly.GetName().Name}");
Copy link
Member

Choose a reason for hiding this comment

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

I see benefits in using a Type cache on message consumption to avoid the Type.GetType call. But when producing I don't know if we will have a performance benefit changing from a string concatenation to a dictionary search.

Copy link
Author

Choose a reason for hiding this comment

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

I think when producing there will be no performance benefit but rather a memory allocations benfit.

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.

[Feature Request]: DefaultTypeResolver caching
2 participants