accumulator/pollard: Speedups for pollard #176
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Things done:
Different implementation of Match known hashes in pollard #3 where the already known hashes of parents were matched, saving sha256 hashes. Instead of going through all the nodes to the path of the leaf being verified, in this implementation just looks for the polNode at the parent position. New method on pollard
readPos
was needed as reading fromgrabPos
created nil hashable nodes.Various comments and small code fixes.
In my testing to block 600,000 on testnet3, the speedups were around 5%. However, when tested on blocks with lower height, the speedups were even less. So more hashing goes on as the tree gets bigger, leading to bigger savings. The matched hashes to the tip of the default server was 160,716,082 hashes and the unmatched hashes were 55,700,940 hashes. So this is around 75% of potential sha computation saved.