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

Performance improvements for decoding ACS results #37

Merged
merged 2 commits into from
Jan 17, 2019

Conversation

Vagabond
Copy link
Member

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

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
@Vagabond Vagabond requested review from evanmcc and vihu January 16, 2019 21:10
@coveralls
Copy link

coveralls commented Jan 16, 2019

Pull Request Test Coverage Report for Build 360

  • 37 of 45 (82.22%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 83.542%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/hbbft.erl 37 45 82.22%
Totals Coverage Status
Change from base Build 354: -0.3%
Covered Lines: 401
Relevant Lines: 480

💛 - Coveralls

Copy link
Member

@vihu vihu left a 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
Copy link
Member

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?

src/hbbft.erl Show resolved Hide resolved
@Vagabond
Copy link
Member Author

Refactored some of the conditionals (some of them were redundant) and removed stale comment.

Copy link
Contributor

@evanmcc evanmcc left a 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.

@Vagabond
Copy link
Member Author

It's extremely possible.

@Vagabond Vagabond merged commit 5c65417 into master Jan 17, 2019
@Vagabond Vagabond deleted the adt/decrypt-performance-fixes branch January 17, 2019 14:47
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.

None yet

4 participants