You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #6678: perf: use vector instead CDeterministicMNList for computing rotating quorums
2389d97 refactor: remove un-needed std::move from GetQuorumQuarterMembersBySnapshot (Konstantin Akimov)
7ab8647 perf: move std::vector of masternodes instead copying during rotation quorum calculation (Konstantin Akimov)
026847a refactor: add default argument maxSize for CalcualeQuorum (Konstantin Akimov)
291ea2e refactor: remove useless variable copy (even with move) (Konstantin Akimov)
fd901e0 perf: futher using std::vector instead CDeterministicMNList (Konstantin Akimov)
80faf1b perf: use vector instead DeterministicMNList for calculation of rotating quorums (Konstantin Akimov)
77273d5 perf: use std::move during quorum calculation (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Helper to get quorum members uses CDeterministicMNList as a source of data.
It makes temporary calculation slower, because temporary lists of masternodes should not construct heavy objects CDeterministicMNList just to keep a list of them.
## What was done?
- helpers `CalculateQuorum`, `CalculateScores` are moved from class `CDeterministicMNList` to `llmq::utils` so far as they don't actually use any private data of `CDeterministicMNList`
- helper `CalculateQuorum` can accept as source of data not only CDeterministicMNList but std::vector with shared ptrs.
- helper `BuildNewQuorumQuarterMembers` does not use CDeterministicMNList for `MnsNotUsedAtH`
- `GetMNUsageBySnapshot` does not use CDeterministicMNList anymore
Also, `BuildNewQuorumQuarterMembers` uses `std::move` when possible.
## How Has This Been Tested?
invalidate + reconsider 15000 blocks; check logs and `perf`.
By perf `PreComputeQuorumMembers` got almost double faster; most improvements came from `GetQuorumQuarterMembersBySnapshot` as expected.
It should give roughly 2% overall improvement for block validation speed and reindex.
PR:
<img width="747" alt="image" src="https://github.com/user-attachments/assets/d27778fa-cc09-4bd7-bccd-601fa6df75f3" />
```
2025-05-20T15:46:53Z [bench] - m_qblockman: 0.05ms [87.08s]
2025-05-20T15:46:53Z [bench] - Connect block: 21.17ms [249.92s (17.38ms/blk)]
```
Develop:
<img width="747" alt="image" src="https://github.com/user-attachments/assets/aff54059-703d-4c76-967a-15279b1b420c" />
```
2025-05-20T16:11:33Z [bench] - m_qblockman: 0.05ms [93.42s]
2025-05-20T16:11:33Z [bench] - Connect block: 19.06ms [256.95s (17.13ms/blk)]
```
## Breaking Changes
N/A
## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
UdjinM6:
utACK 2389d97
PastaPastaPasta:
utACK 2389d97
Tree-SHA512: 86db57e74eb815cc030421610d20e2dd90dfd18fcf429f97ba96681b69539cce54b0f4c9146e29beb541d1e0193919a1242bd08cba8df7017cfe4b42b8be7a63
0 commit comments