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

Reduce allocations in metrics backed by Zero Contention Counter #7206

Merged
merged 4 commits into from
Jun 21, 2024

Conversation

benaadams
Copy link
Member

While the ThreadLocal removes all contention; it does allocate a new List every time the values are totalled.

image

Changes

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Isn't reflection slow? Can we do Reflection.Emit or something to make it fast?

Or use compiled delegates: https://stackoverflow.com/a/65140648

@benaadams
Copy link
Member Author

Changed to typed compiled expression

@benaadams benaadams merged commit cd46bf8 into master Jun 21, 2024
68 checks passed
@benaadams benaadams deleted the zero-contention-counter branch June 21, 2024 10:47
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.

2 participants