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 ResettableRateCounter #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

paulbellamy
Copy link
Owner

#23

There is a Counter.Reset() method, but not a RateCounter.Reset() method. Making the RateCounter atomically resettable adds some performance overhead, so I've added a new ResettableRateCounter, which adds this overhead but has a Reset() method.

@cleeland, does this work for you?

Benchmark on my machine for reference:

Benchmark Normal Resettable Difference
Basic 330.5 ns/op 518.3 ns/op +56.8%
Parallel 467.1 ns/op 468.3 ns/op +0.2%
With5MillionExisting 305.5 ns/op 507.8 ns/op +66.2%

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.

1 participant