From 6e631fbbd746c48babf59542dd78a5c5daf84b54 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Mon, 23 Dec 2024 14:13:10 -0800 Subject: [PATCH] Use data structures with less overhead --- src/common/paired_info/concurrent_pair_info_buffer.hpp | 3 --- src/common/paired_info/distance_estimation.cpp | 2 +- src/common/paired_info/distance_estimation.hpp | 2 +- src/common/paired_info/pair_info_improver.hpp | 6 +++--- src/common/paired_info/paired_info.hpp | 7 ++----- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/common/paired_info/concurrent_pair_info_buffer.hpp b/src/common/paired_info/concurrent_pair_info_buffer.hpp index 5d4305732..3f859f59e 100644 --- a/src/common/paired_info/concurrent_pair_info_buffer.hpp +++ b/src/common/paired_info/concurrent_pair_info_buffer.hpp @@ -131,9 +131,6 @@ using ConcurrentPairedInfoBuffer = ConcurrentPairedBuffer using ConcurrentClusteredPairedInfoBuffer = ConcurrentPairedBuffer; -template -using ConcurrentUnorderedClusteredPairedInfoBuffer = ConcurrentPairedBuffer; - } // namespace de } // namespace omnigraph diff --git a/src/common/paired_info/distance_estimation.cpp b/src/common/paired_info/distance_estimation.cpp index 657128c65..d6b88e667 100644 --- a/src/common/paired_info/distance_estimation.cpp +++ b/src/common/paired_info/distance_estimation.cpp @@ -78,7 +78,7 @@ AbstractDistanceEstimator::OutHistogram AbstractDistanceEstimator::ClusterResult void DistanceEstimator::Estimate(PairedInfoIndexT &result, size_t nthreads) const { this->Init(); const auto &index = this->index(); - ConcurrentUnorderedClusteredPairedInfoBuffer buffer(graph()); + Buffer buffer(graph()); omnigraph::IterationHelper edges(graph()); auto ranges = edges.Ranges(nthreads * 16); diff --git a/src/common/paired_info/distance_estimation.hpp b/src/common/paired_info/distance_estimation.hpp index 1d3b8bcc7..4f901a014 100644 --- a/src/common/paired_info/distance_estimation.hpp +++ b/src/common/paired_info/distance_estimation.hpp @@ -115,7 +115,7 @@ class DistanceEstimator : public AbstractDistanceEstimator { typedef typename base::OutPairedIndex OutPairedIndex; typedef typename base::InHistogram InHistogram; typedef typename base::OutHistogram OutHistogram; - typedef ConcurrentUnorderedClusteredPairedInfoBuffer Buffer; + typedef ConcurrentClusteredPairedInfoBuffer Buffer; public: DistanceEstimator(const debruijn_graph::Graph &graph, diff --git a/src/common/paired_info/pair_info_improver.hpp b/src/common/paired_info/pair_info_improver.hpp index b19ab6d51..95969ae8a 100644 --- a/src/common/paired_info/pair_info_improver.hpp +++ b/src/common/paired_info/pair_info_improver.hpp @@ -45,7 +45,7 @@ class PairInfoImprover { typedef std::vector > PairInfos; typedef std::pair EdgePair; typedef omnigraph::de::PairedInfoIndexT Index; - typedef omnigraph::de::ConcurrentUnorderedClusteredPairedInfoBuffer Buffer; + typedef omnigraph::de::ConcurrentClusteredPairedInfoBuffer Buffer; public: PairInfoImprover(const Graph& g, @@ -142,7 +142,7 @@ class PairInfoImprover { DEBUG("Merging maps"); // FIXME: This is a bit crazy, but we do not have a sane way to iterate // over buffer. In any case, this is better than it used to be before - omnigraph::de::UnorderedPairedInfoIndexT to_remove(graph_); + omnigraph::de::MutablePairedInfoIndexT to_remove(graph_); to_remove.MoveAssign(buf); DEBUG("Resulting size " << to_remove.size()); @@ -189,7 +189,7 @@ class PairInfoImprover { DEBUG("Merging maps"); // FIXME: This is a bit crazy, but we do not have a sane way to iterate // over buffer. In any case, this is better than it used to be before - omnigraph::de::UnorderedPairedInfoIndexT to_add(graph_); + omnigraph::de::MutablePairedInfoIndexT to_add(graph_); to_add.MoveAssign(buf); DEBUG("Resulting size " << to_add.size()); diff --git a/src/common/paired_info/paired_info.hpp b/src/common/paired_info/paired_info.hpp index b07cc326b..181c5d605 100644 --- a/src/common/paired_info/paired_info.hpp +++ b/src/common/paired_info/paired_info.hpp @@ -604,13 +604,10 @@ template using PairedInfoIndexT = PairedIndex; template -using phmap_map = NoLockingAdapter>; //Two-parameters wrapper +using btree_map = NoLockingAdapter>; //Two-parameters wrapper template -using UnorderedPairedInfoIndexT = PairedIndex; - -template -using btree_map = NoLockingAdapter>; //Two-parameters wrapper +using MutablePairedInfoIndexT = PairedIndex; template using UnclusteredPairedInfoIndexT = PairedIndex;