Skip to content

Caching immutable voterKeys#22198

Open
ppatierno wants to merge 1 commit intoapache:trunkfrom
ppatierno:ctor-init-voterkeys
Open

Caching immutable voterKeys#22198
ppatierno wants to merge 1 commit intoapache:trunkfrom
ppatierno:ctor-init-voterkeys

Conversation

@ppatierno
Copy link
Copy Markdown
Contributor

The voters field within the VoterSet is final an initialized within the constructor only and never changes.
The voterKeys() method is called several times and it always computes the mapping and the collection from the voters field on each call creating stream overhead and allocating a new HashSet. Unless I am missing anything it seems to be useless.
This PR changes such behaviour computing an immutable HashSet voterKeys one time in the constructor.

Signed-off-by: Paolo Patierno <ppatierno@live.com>
@github-actions github-actions Bot added triage PRs from the community kraft small Small PRs labels May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kraft small Small PRs triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant