Repository navigation
perf(pools): various performance improvements and cleanups in certification and consensus pools - #11953
Draft
pierugo-dfinity wants to merge 13 commits into
Draft
perf(pools): various performance improvements and cleanups in certification and consensus pools #11953pierugo-dfinity wants to merge 13 commits into
pierugo-dfinity wants to merge 13 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused refactor preserves hashing, index consistency, ordering, and purge boundaries, with no blocking issues identified.
No open issues 🎉
What changed in this PR
This PR reduces allocation, cloning, and height-scanning overhead in the certification and in-memory consensus pools while simplifying their internal APIs.
Changes:
- Purge indexed artifacts below a height directly and streamline range queries.
- Store unvalidated certifications and shares in separate, typed maps.
- Move the artifact-height helper out of the public interface and into test-only code, updating consistency assertions.
| File | Description |
|---|---|
rs/interfaces/src/certification.rs |
Removes the artifact-height helper from the public pool trait. |
rs/artifact_pool/src/inmemory_pool.rs |
Streamlines purging, artifact retrieval, and height queries. |
rs/artifact_pool/src/height_index.rs |
Adds draining purge iteration and direct height-bound accessors. |
rs/artifact_pool/src/certification_pool.rs |
Splits unvalidated storage by artifact type and updates tests. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
unvalidated_{share/cert}_indexand splitunvalidatedinto shares and full certs, both to leverage the type system more and avoid potential bugs (f.ex. we remove a panic).HeightIndex::remove_all_belowreturn the removed artifacts: this simplify and improves the performance of both consensus'purge_belowand certification'sremove_all_unvalidated_belowby avoiding an additional iteration.HeightIndex::heights, providemin_heightandmax_height, since this is only what the production callers care for. It avoids iterating and sometimes collecting.CertificationPoolImpl::all_heights_with_artifactsto test-only and remove it from the trait since it was not used in production.inmemory_pool.rsandlmdb_pool.rs(i.e. consensus pools).