clusterlin: simplify PickMergeCandidate (optimization)

The current process consists of iterating over the transactions of the
chunk one by one, and then for each figuring out which of its
parents/children are in unprocessed chunks.

Simplify this (and speed it up slightly) by splitting this process into
two phases: first determine the union of all parents/children, and then
find which chunks those belong to.
This commit is contained in:
Pieter Wuille
2025-12-26 10:50:35 -05:00
committed by Pieter Wuille
parent dcf458ffb9
commit 6f898dbb8b
2 changed files with 45 additions and 34 deletions

View File

@@ -403,13 +403,13 @@ inline uint64_t MaxOptimalLinearizationIters(DepGraphIndex cluster_count)
static constexpr uint64_t ITERS[65] = {
0,
0, 4, 10, 34, 76, 156, 229, 380,
432, 607, 738, 896, 1037, 1366, 1464, 1711,
2060, 2542, 3068, 3116, 4029, 3467, 5324, 5402,
6481, 7161, 7441, 8329, 8843, 9353, 11104, 11269,
11791, 11981, 12413, 14259, 15331, 12397, 13581, 18569,
18737, 16581, 23217, 23271, 27350, 28591, 33636, 34486,
34414, 26227, 35570, 38045, 40814, 29622, 37793, 32122,
35915, 49823, 39722, 43765, 42365, 53620, 59417, 67035
432, 517, 678, 896, 1037, 1366, 1479, 1711,
2060, 2542, 3068, 3116, 4029, 3467, 5324, 5512,
6481, 7161, 7441, 8183, 8843, 9353, 11104, 11269,
12354, 11871, 13367, 14259, 14229, 12397, 13581, 17774,
18737, 16581, 23217, 24044, 29597, 28879, 34069, 34162,
36028, 26227, 34471, 37212, 40814, 29554, 40305, 34019,
36582, 55659, 39994, 41277, 42365, 52822, 60151, 67035
};
assert(cluster_count < std::size(ITERS));
// Multiply the table number by two, to account for the fact that they are not absolutes.