Skip to content

Commit

Permalink
reuse allocation of search and raptor state
Browse files Browse the repository at this point in the history
  • Loading branch information
mority committed Apr 30, 2024
1 parent e3defd9 commit 6d70e40
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions benchmark/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,22 @@ int main(int argc, char* argv[]) {
auto query_processing_timer =
scoped_timer(fmt::format("processing of {} queries", queries.size()));
progress_tracker->status("processing queries").in_high(queries.size());
utl::parallel_for_run(
struct query_state {
search_state ss_;
raptor_state rs_;
};
utl::parallel_for_run_threadlocal<query_state>(
queries.size(),
[&](auto const q_idx) {
auto ss = search_state{};
auto rs = raptor_state{};
[&](auto& query_state, auto const q_idx) {
query_state.ss_ = search_state{};
query_state.rs_ = raptor_state{};

try {
auto const result =
routing::search<direction::kForward,
routing::raptor<direction::kForward, false>>{
**tt, nullptr, ss, rs, queries[q_idx]}
**tt, nullptr, query_state.ss_, query_state.rs_,
queries[q_idx]}
.execute();
std::lock_guard<std::mutex> guard(mutex);
results.emplace_back(q_idx, result);
Expand Down

0 comments on commit 6d70e40

Please sign in to comment.