diff options
| author | Rutger Broekhoff | 2026-09-08 12:30:06 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-09-08 12:30:06 +0200 |
| commit | e3e0dc994c6ba244472f58b940d0196616bb84b0 (patch) | |
| tree | 5145e91ff96490158e312068e39123fee945c896 /server/src/api.cpp | |
| parent | 3fcfe8e5b2c76efeea1e838fb6b7e235804ecd8f (diff) | |
| download | routemon-e3e0dc994c6ba244472f58b940d0196616bb84b0.tar.gz routemon-e3e0dc994c6ba244472f58b940d0196616bb84b0.zip | |
More performance improvements
Diffstat (limited to 'server/src/api.cpp')
| -rw-r--r-- | server/src/api.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/server/src/api.cpp b/server/src/api.cpp index 137666b..e35e1b3 100644 --- a/server/src/api.cpp +++ b/server/src/api.cpp | |||
| @@ -95,7 +95,7 @@ auto tag_invoke(json::value_from_tag, json::value& jv, sysinfo const& info) | |||
| 95 | {"using_publication_of", | 95 | {"using_publication_of", |
| 96 | std::format("{:%FT%TZ}", info.using_publication_of)}, | 96 | std::format("{:%FT%TZ}", info.using_publication_of)}, |
| 97 | {"blse_index_size", info.blse_index_size}, | 97 | {"blse_index_size", info.blse_index_size}, |
| 98 | {"p_index_size", info.p_index_size}, | 98 | {"bpe_index_size", info.bpe_index_size}, |
| 99 | }; | 99 | }; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| @@ -124,7 +124,7 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) | |||
| 124 | } | 124 | } |
| 125 | for (auto p : rc->relevant_points) | 125 | for (auto p : rc->relevant_points) |
| 126 | { | 126 | { |
| 127 | p_index_.insert(p_index_value{p, rc}); | 127 | bpe_index_.insert(p, rc); |
| 128 | } | 128 | } |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -141,7 +141,7 @@ handler::handler(log::logger const& l, datex2::situation_publication pub) | |||
| 141 | auto const dur_build_s = chrono::duration<double>{after_build - before_build}; | 141 | auto const dur_build_s = chrono::duration<double>{after_build - before_build}; |
| 142 | l_.info("Indexes built in {}", dur_build_s); | 142 | l_.info("Indexes built in {}", dur_build_s); |
| 143 | l_.info("BLSE index size: {}", blse_index_.size()); | 143 | l_.info("BLSE index size: {}", blse_index_.size()); |
| 144 | l_.info("Point index size: {}", p_index_.size()); | 144 | l_.info("Point index size: {}", bpe_index_.size()); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | auto handler::process_gpx(gpx::file&& gpx_file) | 147 | auto handler::process_gpx(gpx::file&& gpx_file) |
| @@ -194,17 +194,12 @@ auto handler::process_gpx(gpx::file&& gpx_file) | |||
| 194 | // relevant_road_closures.emplace(rc); | 194 | // relevant_road_closures.emplace(rc); |
| 195 | ls_checked++; | 195 | ls_checked++; |
| 196 | } | 196 | } |
| 197 | for (auto it = p_index_.qbegin(bgeo::index::intersects(part_box)); | 197 | for (auto const& rc : bpe_index_.intersection(part_zone_lss)) |
| 198 | it != p_index_.qend(); it++) | ||
| 199 | { | 198 | { |
| 200 | // Cannot use structured bindings here for the same reason as above. | ||
| 201 | geo::utm::zonable_wgs84_point const& p = std::get<0>(*it); | ||
| 202 | std::shared_ptr<datex2::road_closure> const& rc = std::get<1>(*it); | ||
| 203 | if (rc->validity | 199 | if (rc->validity |
| 204 | && rc->validity->intersect(check_periods).periods().empty()) | 200 | && rc->validity->intersect(check_periods).periods().empty()) |
| 205 | continue; | 201 | continue; |
| 206 | if (bgeo::distance(p, part, vincenty_strategy) < min_distance_) | 202 | relevant_road_closures.emplace(rc); |
| 207 | relevant_road_closures.emplace(rc); | ||
| 208 | p_checked++; | 203 | p_checked++; |
| 209 | } | 204 | } |
| 210 | } | 205 | } |
| @@ -285,7 +280,7 @@ auto handler::sysinfo() -> struct sysinfo | |||
| 285 | return { | 280 | return { |
| 286 | .using_publication_of = pub_.publication_time, | 281 | .using_publication_of = pub_.publication_time, |
| 287 | .blse_index_size = blse_index_.size(), | 282 | .blse_index_size = blse_index_.size(), |
| 288 | .p_index_size = p_index_.size(), | 283 | .bpe_index_size = bpe_index_.size(), |
| 289 | }; | 284 | }; |
| 290 | } | 285 | } |
| 291 | 286 | ||