From 15bcf23f2e75f9c710eee3753d530ebefc5f78f1 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Sun, 30 Aug 2026 15:29:41 +0200 Subject: Another (at this point perhaps needless) optimization attempt --- server/src/api.cpp | 24 ++++++++++++------------ server/src/api.cppm | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'server') diff --git a/server/src/api.cpp b/server/src/api.cpp index 9953675..5dd3fc5 100644 --- a/server/src/api.cpp +++ b/server/src/api.cpp @@ -92,7 +92,7 @@ auto tag_invoke(json::value_from_tag, json::value& jv, sysinfo const& info) jv = json::object{ {"using_publication_of", std::format("{:%FT%TZ}", info.using_publication_of)}, - {"lse_index_size", info.lse_index_size}, + {"blse_index_size", info.blse_index_size}, {"p_index_size", info.p_index_size}, }; } @@ -135,13 +135,13 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) { for (auto const& ls : rc->relevant_line_strings) { - auto box = geo::box{}; - bgeo::envelope(*ls, box); auto buffered_ls = geo::multi_polygon{}; bgeo::buffer( *ls, buffered_ls, distance_strategy, side_strategy, join_strategy, end_strategy, circle_strategy); - lse_index_.insert(std::make_tuple(box, buffered_ls, rc)); + auto blse = geo::box{}; + bgeo::envelope(buffered_ls, blse); + blse_index_.insert(std::make_tuple(blse, buffered_ls, rc)); } for (auto p : rc->relevant_points) { @@ -161,7 +161,7 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) auto const after_build = chrono::steady_clock::now(); auto const dur_build_s = chrono::duration{after_build - before_build}; l_.info("Indices built in {}", dur_build_s); - l_.info("LSE index size: {}", lse_index_.size()); + l_.info("BLSE index size: {}", blse_index_.size()); l_.info("Point index size: {}", p_index_.size()); } @@ -200,19 +200,19 @@ auto handler::process_gpx(gpx::file&& gpx_file) auto part_box = geo::box{}; bgeo::envelope(part, part_box); - for (auto it = lse_index_.qbegin(bgeo::index::intersects(part_box)); - it != lse_index_.qend(); it++) + for (auto it = blse_index_.qbegin(bgeo::index::intersects(part_box)); + it != blse_index_.qend(); it++) { // Cannot use structured bindings here, as boost::geometry::get // interferes with ADL. It is a candidate as the namespace // boost::geometry is part of the associated namespace set, which // happens because geo::linestring ≡ // boost::geometry::model::linestring is part of the - // whole tuple type (lse_index_value) that is the value_type of the + // whole tuple type (blse_index_value) that is the value_type of the // iterator. - // geo::box const& lse = std::get<0>(*it); - geo::multi_polygon const& buffered_ls = std::get<1>(*it); + geo::box const& blse = std::get<0>(*it); + geo::multi_polygon const& bls = std::get<1>(*it); std::shared_ptr const& rc = std::get<2>(*it); if (rc->validity && rc->validity->intersect(check_periods).periods().empty()) @@ -221,7 +221,7 @@ auto handler::process_gpx(gpx::file&& gpx_file) // auto small_parts = bgeo::model::multi_linestring{}; // bgeo::intersection(part, lse, small_parts); - if (bgeo::intersects(buffered_ls, part)) + if (bgeo::intersects(blse, part) && bgeo::intersects(bls, part)) relevant_road_closures.emplace(rc); // if (!bgeo::is_empty(small_parts)) @@ -318,7 +318,7 @@ auto handler::sysinfo() -> struct sysinfo { return { .using_publication_of = pub_.publication_time, - .lse_index_size = lse_index_.size(), + .blse_index_size = blse_index_.size(), .p_index_size = p_index_.size(), }; } diff --git a/server/src/api.cppm b/server/src/api.cppm index 6f301c4..b0f3944 100644 --- a/server/src/api.cppm +++ b/server/src/api.cppm @@ -55,7 +55,7 @@ struct process_gpx_result struct sysinfo { time::timestamp using_publication_of; - std::size_t lse_index_size; + std::size_t blse_index_size; std::size_t p_index_size; }; @@ -79,18 +79,18 @@ class handler { constexpr static auto const min_distance_ = 5.0; - using lse_index_value = std::tuple< + using blse_index_value = std::tuple< geo::box, geo::multi_polygon, std::shared_ptr >; using p_index_value = std::pair>; - using lse_index = - bgeo::index::rtree>; + using blse_index = + bgeo::index::rtree>; using p_index = bgeo::index::rtree>; log::logger l_; datex2::situation_publication pub_; - lse_index lse_index_; + blse_index blse_index_; p_index p_index_; public: -- cgit v1.3