Skip to content

Commit

Permalink
Minor code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Oct 30, 2024
1 parent ccb990f commit 26509f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions src/engine/TransitivePathBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ Result::Generator TransitivePathBase::fillTableWithHullImpl(
std::vector<LocalVocab> storedLocalVocabs;
for (auto& [node, linkedNodes, localVocab, idTable, inputRow] : hull) {
timer.cont();
// As an optimization nodes without any linked nodes should not get yielded
// in the first place.
AD_CONTRACT_CHECK(!linkedNodes.empty());
if (!yieldOnce) {
table.reserve(linkedNodes.size());
}
Expand All @@ -116,16 +119,14 @@ Result::Generator TransitivePathBase::fillTableWithHullImpl(
outputRow++;
}

if (!table.empty()) {
if (yieldOnce) {
storedLocalVocabs.emplace_back(std::move(localVocab));
} else {
timer.stop();
runtimeInfo().addDetail("IdTable fill time", timer.msecs());
co_yield {std::move(table).toDynamic(), std::move(localVocab)};
table = IdTableStatic<OUTPUT_WIDTH>{getResultWidth(), allocator()};
outputRow = 0;
}
if (yieldOnce) {
storedLocalVocabs.emplace_back(std::move(localVocab));
} else {
timer.stop();
runtimeInfo().addDetail("IdTable fill time", timer.msecs());
co_yield {std::move(table).toDynamic(), std::move(localVocab)};
table = IdTableStatic<OUTPUT_WIDTH>{getResultWidth(), allocator()};
outputRow = 0;
}
timer.stop();
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/TransitivePathImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ class TransitivePathImpl : public TransitivePathBase {
mergedVocab.mergeWith(std::span{&edgesVocab, 1});
size_t currentRow = 0;
for (Id startNode : tableColumn.column_) {
timer.cont();
Set connectedNodes = findConnectedNodes(edges, startNode, target);
if (!connectedNodes.empty()) {
timer.stop();
runtimeInfo().addDetail("Hull time", timer.msecs());
timer.stop();
co_yield NodeWithTargets{startNode, std::move(connectedNodes),
mergedVocab.clone(), tableColumn.table_,
currentRow};
timer.cont();
}
currentRow++;
}
Expand Down

0 comments on commit 26509f8

Please sign in to comment.