-
Notifications
You must be signed in to change notification settings - Fork 180
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
hotstuff: improve the latency of hotstuff verification #1523
Conversation
This will remove the requirement for a mutex, and just use atomic instructions instead.
Codecov Report
@@ Coverage Diff @@
## master #1523 +/- ##
==========================================
- Coverage 55.33% 55.21% -0.12%
==========================================
Files 527 535 +8
Lines 32626 33118 +492
==========================================
+ Hits 18053 18287 +234
- Misses 12161 12393 +232
- Partials 2412 2438 +26
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
lastStakingKey crypto.PublicKey | ||
sync.RWMutex | ||
current unsafe.Pointer // *aggregate type | ||
inner *aggregate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having inner
here later can cause some complications. ( confusing )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a name change or comment would help? What would you like to see ?
} | ||
|
||
aggregator.current = unsafe.Pointer(aggregator.inner) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think updateCurrent
would be better choice here, without inner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I tried that and there was a problem in the tests. If you want to paste your code change suggestion, I'll try it.
I think if this mutex is causing performance problems, it is just a symptom not the cause of the problem. But I really liked the update, avoiding mutex like this is also very cool. |
Took a brief pass over the PR and it looks great. However concurrency safety probably warrants some detailed comments in the code is:
In your particular implementation, a reviewer might ask: "There is no concurrency protection to Hope that makes sense (?) |
I'm closing this for now, because tests are inconclusive |
This will remove the requirement for a mutex, and just use
atomic instructions instead.