Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Apr 27, 2023
1 parent f74880c commit cc81a73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
14 changes: 9 additions & 5 deletions src/graph/executor/algo/AllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,10 @@ folly::Future<Status> AllPathsExecutor::buildResult() {

folly::Future<Status> AllPathsExecutor::buildPathMultiJobs() {
auto pathsPtr = std::make_shared<std::vector<NPath*>>();
threadLocalPtr_.reset(new std::vector<NPath*>());
threadLocalPtr_->reserve(64);
if (threadLocalPtr_.get() == nullptr) {
threadLocalPtr_.reset(new std::vector<NPath*>());
threadLocalPtr_->reserve(64);
}
for (auto& vid : leftInitVids_) {
auto vidIter = leftAdjList_.find(vid);
if (vidIter == leftAdjList_.end()) {
Expand Down Expand Up @@ -368,8 +370,10 @@ folly::Future<std::vector<Row>> AllPathsExecutor::doBuildPath(
if (cnt_.load(std::memory_order_relaxed) >= limit_) {
return folly::makeFuture<std::vector<Row>>(std::vector<Row>());
}
threadLocalPtr_.reset(new std::vector<NPath*>());
threadLocalPtr_->reserve(64);
if (threadLocalPtr_.get() == nullptr) {
threadLocalPtr_.reset(new std::vector<NPath*>());
threadLocalPtr_->reserve(64);
}
auto& adjList = leftAdjList_;
auto currentPathPtr = std::make_unique<std::vector<Row>>();
auto newPathsPtr = std::make_shared<std::vector<NPath*>>();
Expand Down Expand Up @@ -508,7 +512,7 @@ Status AllPathsExecutor::close() {
auto accessor = threadLocalPtr_.accessAllThreads();
for (auto iter = accessor.begin(); iter != accessor.end(); ++iter) {
for (auto& ptr : *iter) {
ptr->~NPath();
delete ptr;
}
}
return Executor::close();
Expand Down
13 changes: 1 addition & 12 deletions src/graph/executor/algo/AllPathsExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ class AllPathsExecutor final : public StorageAccessExecutor {
NPath(NPath* path, const Value& v, const Value& e) : p(path), vertex(v), edge(e) {}
NPath(NPath&& v) noexcept : p(v.p), vertex(std::move(v.vertex)), edge(std::move(v.edge)) {}
NPath(const NPath& v) : p(v.p), vertex(v.vertex), edge(v.edge) {}
~NPath() {
if (p != nullptr) {
delete p;
p = nullptr;
}
}
~NPath() {}
};

private:
Expand All @@ -78,12 +73,6 @@ class AllPathsExecutor final : public StorageAccessExecutor {

Row convertNPath2Row(NPath* path);

// folly::Future<std::vector<Row>> doBuildPath(
// size_t step,
// size_t start,
// size_t end,
// std::shared_ptr<std::vector<std::vector<Value>>> edgeLists);

folly::Future<std::vector<Row>> doBuildPath(size_t step,
size_t start,
size_t end,
Expand Down

0 comments on commit cc81a73

Please sign in to comment.