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 Hasblock #4821

Merged
merged 8 commits into from Feb 10, 2020
Merged

Optimize Hasblock #4821

merged 8 commits into from Feb 10, 2020

Conversation

terencechain
Copy link
Member

We often check a validity of an object by whether the corresponding block has been processed. The naive way is to check block exists in DB. Another less known way is check if the block exists in fork choice store. Check fork choice store is ~10x faster than DB:

BenchmarkHasBlockDB-12                   2767405               381 ns/op
BenchmarkHasBlockForkChoiceStore-12     23765187                40.0 ns/op

This implements hasBlock which checks fork choice store first then check DB

@terencechain terencechain self-assigned this Feb 10, 2020
@terencechain terencechain added the Enhancement New feature or request label Feb 10, 2020
@codecov
Copy link

codecov bot commented Feb 10, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@822d1c5). Click here to learn what that means.
The diff coverage is 39.17%.

@@           Coverage Diff            @@
##             master   #4821   +/-   ##
========================================
  Coverage          ?   43.1%           
========================================
  Files             ?     201           
  Lines             ?   14944           
  Branches          ?       0           
========================================
  Hits              ?    6441           
  Misses            ?    7450           
  Partials          ?    1053

@rauljordan rauljordan merged commit 56fcca6 into master Feb 10, 2020
@delete-merged-branch delete-merged-branch bot deleted the optimize-has-block branch February 10, 2020 21:48
cryptomental pushed a commit to cryptomental/prysm that referenced this pull request Feb 24, 2020
* Expose node

* Comments

* Extra line

* Add has block

* Test

* Usages

* Fixed tests
cryptomental pushed a commit to cryptomental/prysm that referenced this pull request Feb 28, 2020
* Expose node

* Comments

* Extra line

* Add has block

* Test

* Usages

* Fixed tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants