diff options
| author | Rutger Broekhoff | 2026-08-30 15:29:41 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-08-30 15:29:41 +0200 |
| commit | 15bcf23f2e75f9c710eee3753d530ebefc5f78f1 (patch) | |
| tree | f5291f804d63662f536b7f8bf6d7e099c88d0754 /server/src/api.cpp | |
| parent | 5abc825cdfaa16580dd05045cdf9847ecd3fcd60 (diff) | |
| download | routemon-15bcf23f2e75f9c710eee3753d530ebefc5f78f1.tar.gz routemon-15bcf23f2e75f9c710eee3753d530ebefc5f78f1.zip | |
Another (at this point perhaps needless) optimization attempt
Diffstat (limited to 'server/src/api.cpp')
| -rw-r--r-- | server/src/api.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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) | |||
| 92 | jv = json::object{ | 92 | jv = json::object{ |
| 93 | {"using_publication_of", | 93 | {"using_publication_of", |
| 94 | std::format("{:%FT%TZ}", info.using_publication_of)}, | 94 | std::format("{:%FT%TZ}", info.using_publication_of)}, |
| 95 | {"lse_index_size", info.lse_index_size}, | 95 | {"blse_index_size", info.blse_index_size}, |
| 96 | {"p_index_size", info.p_index_size}, | 96 | {"p_index_size", info.p_index_size}, |
| 97 | }; | 97 | }; |
| 98 | } | 98 | } |
| @@ -135,13 +135,13 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) | |||
| 135 | { | 135 | { |
| 136 | for (auto const& ls : rc->relevant_line_strings) | 136 | for (auto const& ls : rc->relevant_line_strings) |
| 137 | { | 137 | { |
| 138 | auto box = geo::box{}; | ||
| 139 | bgeo::envelope(*ls, box); | ||
| 140 | auto buffered_ls = geo::multi_polygon{}; | 138 | auto buffered_ls = geo::multi_polygon{}; |
| 141 | bgeo::buffer( | 139 | bgeo::buffer( |
| 142 | *ls, buffered_ls, distance_strategy, side_strategy, join_strategy, | 140 | *ls, buffered_ls, distance_strategy, side_strategy, join_strategy, |
| 143 | end_strategy, circle_strategy); | 141 | end_strategy, circle_strategy); |
| 144 | lse_index_.insert(std::make_tuple(box, buffered_ls, rc)); | 142 | auto blse = geo::box{}; |
| 143 | bgeo::envelope(buffered_ls, blse); | ||
| 144 | blse_index_.insert(std::make_tuple(blse, buffered_ls, rc)); | ||
| 145 | } | 145 | } |
| 146 | for (auto p : rc->relevant_points) | 146 | for (auto p : rc->relevant_points) |
| 147 | { | 147 | { |
| @@ -161,7 +161,7 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) | |||
| 161 | auto const after_build = chrono::steady_clock::now(); | 161 | auto const after_build = chrono::steady_clock::now(); |
| 162 | auto const dur_build_s = chrono::duration<double>{after_build - before_build}; | 162 | auto const dur_build_s = chrono::duration<double>{after_build - before_build}; |
| 163 | l_.info("Indices built in {}", dur_build_s); | 163 | l_.info("Indices built in {}", dur_build_s); |
| 164 | l_.info("LSE index size: {}", lse_index_.size()); | 164 | l_.info("BLSE index size: {}", blse_index_.size()); |
| 165 | l_.info("Point index size: {}", p_index_.size()); | 165 | l_.info("Point index size: {}", p_index_.size()); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| @@ -200,19 +200,19 @@ auto handler::process_gpx(gpx::file&& gpx_file) | |||
| 200 | auto part_box = geo::box{}; | 200 | auto part_box = geo::box{}; |
| 201 | bgeo::envelope(part, part_box); | 201 | bgeo::envelope(part, part_box); |
| 202 | 202 | ||
| 203 | for (auto it = lse_index_.qbegin(bgeo::index::intersects(part_box)); | 203 | for (auto it = blse_index_.qbegin(bgeo::index::intersects(part_box)); |
| 204 | it != lse_index_.qend(); it++) | 204 | it != blse_index_.qend(); it++) |
| 205 | { | 205 | { |
| 206 | // Cannot use structured bindings here, as boost::geometry::get | 206 | // Cannot use structured bindings here, as boost::geometry::get |
| 207 | // interferes with ADL. It is a candidate as the namespace | 207 | // interferes with ADL. It is a candidate as the namespace |
| 208 | // boost::geometry is part of the associated namespace set, which | 208 | // boost::geometry is part of the associated namespace set, which |
| 209 | // happens because geo::linestring ≡ | 209 | // happens because geo::linestring ≡ |
| 210 | // boost::geometry::model::linestring<geo::point> is part of the | 210 | // boost::geometry::model::linestring<geo::point> is part of the |
| 211 | // whole tuple type (lse_index_value) that is the value_type of the | 211 | // whole tuple type (blse_index_value) that is the value_type of the |
| 212 | // iterator. | 212 | // iterator. |
| 213 | 213 | ||
| 214 | // geo::box const& lse = std::get<0>(*it); | 214 | geo::box const& blse = std::get<0>(*it); |
| 215 | geo::multi_polygon const& buffered_ls = std::get<1>(*it); | 215 | geo::multi_polygon const& bls = std::get<1>(*it); |
| 216 | std::shared_ptr<datex2::road_closure> const& rc = std::get<2>(*it); | 216 | std::shared_ptr<datex2::road_closure> const& rc = std::get<2>(*it); |
| 217 | if (rc->validity | 217 | if (rc->validity |
| 218 | && rc->validity->intersect(check_periods).periods().empty()) | 218 | && rc->validity->intersect(check_periods).periods().empty()) |
| @@ -221,7 +221,7 @@ auto handler::process_gpx(gpx::file&& gpx_file) | |||
| 221 | // auto small_parts = bgeo::model::multi_linestring<geo::linestring>{}; | 221 | // auto small_parts = bgeo::model::multi_linestring<geo::linestring>{}; |
| 222 | // bgeo::intersection(part, lse, small_parts); | 222 | // bgeo::intersection(part, lse, small_parts); |
| 223 | 223 | ||
| 224 | if (bgeo::intersects(buffered_ls, part)) | 224 | if (bgeo::intersects(blse, part) && bgeo::intersects(bls, part)) |
| 225 | relevant_road_closures.emplace(rc); | 225 | relevant_road_closures.emplace(rc); |
| 226 | 226 | ||
| 227 | // if (!bgeo::is_empty(small_parts)) | 227 | // if (!bgeo::is_empty(small_parts)) |
| @@ -318,7 +318,7 @@ auto handler::sysinfo() -> struct sysinfo | |||
| 318 | { | 318 | { |
| 319 | return { | 319 | return { |
| 320 | .using_publication_of = pub_.publication_time, | 320 | .using_publication_of = pub_.publication_time, |
| 321 | .lse_index_size = lse_index_.size(), | 321 | .blse_index_size = blse_index_.size(), |
| 322 | .p_index_size = p_index_.size(), | 322 | .p_index_size = p_index_.size(), |
| 323 | }; | 323 | }; |
| 324 | } | 324 | } |