Skip to content

Commit

Permalink
fix: use ref in setTreeFiltererCandidates
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 7, 2020
1 parent 86c1ff7 commit 3075fe4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fuzzaldrin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ Napi::Value Fuzzaldrin::setTreeFiltererCandidates(const Napi::CallbackInfo &info
const string childrenKey = info[2].As<Napi::String>();

// create Tree and set candidates
_tree = Tree(jsTreeArray, dataKey, childrenKey);
_tree = Tree(move_const(jsTreeArray), move_const(dataKey), move_const(childrenKey));

const auto &candidates = _tree.entriesArray;
const auto candidates = ref(_tree.entriesArray);

const auto N = candidates.size();// different
const auto N = candidates.get().size();// different
const auto num_chunks = N < 1000 * kMaxThreads ? N / 1000 + 1 : kMaxThreads;
candidates_.clear();
candidates_.resize(num_chunks);
Expand All @@ -80,7 +80,7 @@ Napi::Value Fuzzaldrin::setTreeFiltererCandidates(const Napi::CallbackInfo &info
chunk_size++;
}
for (auto j = cur_start; j < cur_start + chunk_size; j++) {
candidates_[i].emplace_back(candidates[j].data);// different // TODO copy
candidates_[i].emplace_back(candidates.get()[j].data);// different // TODO copy
}
cur_start += chunk_size;
}
Expand Down

0 comments on commit 3075fe4

Please sign in to comment.