Skip to content

Commit

Permalink
Use data structures with less overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed Dec 25, 2024
1 parent b34b02f commit 6e631fb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/common/paired_info/concurrent_pair_info_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ using ConcurrentPairedInfoBuffer = ConcurrentPairedBuffer<Graph, RawPointTraits,
template<class Graph>
using ConcurrentClusteredPairedInfoBuffer = ConcurrentPairedBuffer<Graph, PointTraits, btree_map>;

template<class Graph>
using ConcurrentUnorderedClusteredPairedInfoBuffer = ConcurrentPairedBuffer<Graph, PointTraits, phmap_map>;

} // namespace de

} // namespace omnigraph
2 changes: 1 addition & 1 deletion src/common/paired_info/distance_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ AbstractDistanceEstimator::OutHistogram AbstractDistanceEstimator::ClusterResult
void DistanceEstimator::Estimate(PairedInfoIndexT<Graph> &result, size_t nthreads) const {
this->Init();
const auto &index = this->index();
ConcurrentUnorderedClusteredPairedInfoBuffer<Graph> buffer(graph());
Buffer buffer(graph());

omnigraph::IterationHelper<Graph, EdgeId> edges(graph());
auto ranges = edges.Ranges(nthreads * 16);
Expand Down
2 changes: 1 addition & 1 deletion src/common/paired_info/distance_estimation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<debruijn_graph::Graph> Buffer;
typedef ConcurrentClusteredPairedInfoBuffer<debruijn_graph::Graph> Buffer;

public:
DistanceEstimator(const debruijn_graph::Graph &graph,
Expand Down
6 changes: 3 additions & 3 deletions src/common/paired_info/pair_info_improver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PairInfoImprover {
typedef std::vector<omnigraph::de::PairInfo<EdgeId> > PairInfos;
typedef std::pair<EdgeId, EdgeId> EdgePair;
typedef omnigraph::de::PairedInfoIndexT<Graph> Index;
typedef omnigraph::de::ConcurrentUnorderedClusteredPairedInfoBuffer<Graph> Buffer;
typedef omnigraph::de::ConcurrentClusteredPairedInfoBuffer<Graph> Buffer;

public:
PairInfoImprover(const Graph& g,
Expand Down Expand Up @@ -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<Graph> to_remove(graph_);
omnigraph::de::MutablePairedInfoIndexT<Graph> to_remove(graph_);
to_remove.MoveAssign(buf);

DEBUG("Resulting size " << to_remove.size());
Expand Down Expand Up @@ -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<Graph> to_add(graph_);
omnigraph::de::MutablePairedInfoIndexT<Graph> to_add(graph_);
to_add.MoveAssign(buf);

DEBUG("Resulting size " << to_add.size());
Expand Down
7 changes: 2 additions & 5 deletions src/common/paired_info/paired_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,10 @@ template<typename Graph>
using PairedInfoIndexT = PairedIndex<Graph, PointTraits, const_btree_map>;

template<typename K, typename V>
using phmap_map = NoLockingAdapter<phmap::parallel_flat_hash_map<K, V>>; //Two-parameters wrapper
using btree_map = NoLockingAdapter<phmap::btree_map<K, V>>; //Two-parameters wrapper

template<typename Graph>
using UnorderedPairedInfoIndexT = PairedIndex<Graph, PointTraits, phmap_map>;

template<typename K, typename V>
using btree_map = NoLockingAdapter<phmap::btree_map<K, V>>; //Two-parameters wrapper
using MutablePairedInfoIndexT = PairedIndex<Graph, PointTraits, btree_map>;

template<typename Graph>
using UnclusteredPairedInfoIndexT = PairedIndex<Graph, RawPointTraits, btree_map>;
Expand Down

0 comments on commit 6e631fb

Please sign in to comment.