Skip to content

Commit

Permalink
#2001: Remove unwanted reconstruction when pre-constructed elements a…
Browse files Browse the repository at this point in the history
…re present
  • Loading branch information
thearusable committed Nov 4, 2022
1 parent aaa7b26 commit 953f033
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/vt/vrt/collection/collection_builder.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,28 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams<ColT>& po) {
po.bulk_inserts_.push_back(po.bounds_);
}

auto cons_fn = po.template getConsFn<ColT>();

// Do all bulk insertions
for (auto&& range : po.bulk_inserts_) {
range.foreach([&](IndexType idx) {
if (elementMappedHere(map_han, map_object, idx, bounds)) {
makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
}
global_constructed_elms++;
});
}
if (po.list_insert_here_.empty()) {
auto cons_fn = po.template getConsFn<ColT>();

// Do all bulk insertions
for (auto&& range : po.bulk_inserts_) {
range.foreach([&](IndexType idx) {
if (elementMappedHere(map_han, map_object, idx, bounds)) {
makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
}
global_constructed_elms++;
});
}

// Do all list insertions
for (auto&& list_fn : po.list_inserts_) {
list_fn([&](IndexType idx) {
if (elementMappedHere(map_han, map_object, idx, bounds)) {
makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
}
global_constructed_elms++;
});
// Do all list insertions
for (auto&& list_fn : po.list_inserts_) {
list_fn([&](IndexType idx) {
if (elementMappedHere(map_han, map_object, idx, bounds)) {
makeCollectionElement<ColT>(proxy, idx, this_node, cons_fn);
}
global_constructed_elms++;
});
}
}

// Do all 'here' insertions
Expand Down

0 comments on commit 953f033

Please sign in to comment.