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

Optimize IsValidAttestationIndices unique sorted indices check #7458

Merged
merged 17 commits into from
Oct 8, 2020

Conversation

terencechain
Copy link
Member

@terencechain terencechain commented Oct 7, 2020

IsValidAttestationIndices​ uses a complicated algorithm for checking whether an array of indices is uniquely sorted.
It should be sufficient to check that each index in the array is less than the next.

Before:
BenchmarkIsValidAttestationIndices-12    	    4606	    227693 ns/op

After:
BenchmarkIsValidAttestationIndices-12    	 1402736	       827 ns/op

prestonvanloon
prestonvanloon previously approved these changes Oct 7, 2020
Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Nice!

@codecov
Copy link

codecov bot commented Oct 8, 2020

Codecov Report

Merging #7458 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #7458   +/-   ##
=======================================
  Coverage   60.40%   60.40%           
=======================================
  Files         424      424           
  Lines       30325    30325           
=======================================
  Hits        18317    18317           
  Misses       9021     9021           
  Partials     2987     2987           

@prylabs-bulldozer prylabs-bulldozer bot merged commit 8f64eb6 into master Oct 8, 2020
@delete-merged-branch delete-merged-branch bot deleted the optimize-is-valid branch October 8, 2020 23:20
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.

3 participants