-
Notifications
You must be signed in to change notification settings - Fork 16
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
Performance improvements for decoding ACS results #37
Conversation
This commit introduces 2 performance optimizations: * Tag each share with its validity status (true, false or undefined) * Only try to decrypt if we haven't already decrypted that result
Pull Request Test Coverage Report for Build 360
💛 - Coveralls |
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.
Added 1 comment inline, nice optimization from #36
src/hbbft.erl
Outdated
%% check if we have enough to decode the bundle | ||
SharesForThisBundle = [ S || {{Idx, _}, S} <- maps:to_list(NewShares), I == Idx], | ||
case length(SharesForThisBundle) > Data#hbbft_data.f andalso not maps:is_key({I, J}, Data#hbbft_data.dec_shares) andalso lists:keymember(I, 1, Data#hbbft_data.acs_results) of | ||
case maps:is_key({I, J}, Data#hbbft_data.dec_shares) orelse maps:is_key(I, Data#hbbft_data.decrypted) of |
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'm just wondering if it would be better to separate these out or change the order of conditions to fail faster? If you already have decrypted no need to check dec_shares presumably?
Refactored some of the conditionals (some of them were redundant) and removed stale comment. |
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 like it. Is there any other place where there might be this sort of behavior? I wonder if this is why you all didn't see your expected EC speedup the other day.
It's extremely possible. |
This commit introduces 2 performance optimizations: