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

Avoid boxing in IEndpointResolverExtensions.cs #1619

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

lechu445
Copy link
Contributor

@lechu445 lechu445 commented Jun 28, 2024

Proposed Changes

Technically T can be a value type. Object.Equals has an overload that takes object therefore any struct would be boxed. To avoid it, EqualityComparer<T>.Default.Equals should be used.

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

Technically T can be a value type. `Object.Equals` has an overload that takes `object` therefore any struct would be boxed. To avoid it, `EqualityComparer<T>.Default.Equals` should be used.
@lukebakken lukebakken self-requested a review June 28, 2024 14:06
@lukebakken lukebakken self-assigned this Jun 28, 2024
@lukebakken lukebakken added this to the 7.0.0 milestone Jun 28, 2024
Copy link
Contributor

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

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

Thanks for noticing. This isn't a hot path in the code, so there won't be a perf improvement, but it's good to know about this option at any rate.

@lukebakken lukebakken merged commit 350a14f into rabbitmq:main Jun 28, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants