From 3380e0cbb59b2a893faabfa8f9aa18e582a11c2f Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 16 Oct 2025 11:23:14 -0400 Subject: [PATCH] txgraph: use PostLinearize less prior to linearizing With the new SFL algorithm, the process of loading an existing linearization into the SFL state is very similar to what PostLinearize does. This means there is little benefit to performing an explicit PostLinearize step before linearizing inside txgraph. Instead, it seems better to use our allotted CPU time to perform more SFL optimization steps. --- src/txgraph.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/txgraph.cpp b/src/txgraph.cpp index 492e13c8900..368b5cf7fb4 100644 --- a/src/txgraph.cpp +++ b/src/txgraph.cpp @@ -1451,14 +1451,6 @@ void SingletonClusterImpl::Merge(TxGraphImpl&, int, Cluster&) noexcept void GenericClusterImpl::ApplyDependencies(TxGraphImpl& graph, int level, std::span> to_apply) noexcept { - // This function is invoked by TxGraphImpl::ApplyDependencies after merging groups of Clusters - // between which dependencies are added, which simply concatenates their linearizations. Invoke - // PostLinearize, which has the effect that the linearization becomes a merge-sort of the - // constituent linearizations. Do this here rather than in Cluster::Merge, because this - // function is only invoked once per merged Cluster, rather than once per constituent one. - // This concatenation + post-linearization could be replaced with an explicit merge-sort. - PostLinearize(m_depgraph, m_linearization); - // Sort the list of dependencies to apply by child, so those can be applied in batch. std::sort(to_apply.begin(), to_apply.end(), [](auto& a, auto& b) { return a.second < b.second; }); // Iterate over groups of to-be-added dependencies with the same child. @@ -1484,9 +1476,8 @@ void GenericClusterImpl::ApplyDependencies(TxGraphImpl& graph, int level, std::s } // Finally fix the linearization, as the new dependencies may have invalidated the - // linearization, and post-linearize it to fix up the worst problems with it. + // linearization. FixLinearization(m_depgraph, m_linearization); - PostLinearize(m_depgraph, m_linearization); Assume(!NeedsSplitting()); Assume(!IsOversized()); if (IsAcceptable()) {