Performance: trim Overpass query, add CPU-usage control, and opt-in pipelined tile merge#1125
Open
TonyD365 wants to merge 10 commits into
Open
Performance: trim Overpass query, add CPU-usage control, and opt-in pipelined tile merge#1125TonyD365 wants to merge 10 commits into
TonyD365 wants to merge 10 commits into
Conversation
The Overpass query included a bare 'way;' selector that pulled every way in the bounding box (plus all their nodes), regardless of tags. Arnis only renders ways carrying recognized tags (building, highway, landuse, etc.), which are already covered by the explicit selectors above, and multipolygon member ways are still fetched via way(r.relsinbbox). The bare selector only added data that gets discarded — for large areas (e.g. the GTA) this was a major source of oversized responses, server-side timeouts, and the resulting multi-server retry cascade. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Removing the unfiltered 'way;' selector exposed one real gap: the renderer dispatches ways carrying 'area:aeroway' (airport aprons / taxiway polygons), but the query only selected plain 'aeroway'. Those area-only features were previously pulled solely via the bare 'way;', so they would have vanished. Add an explicit nwr["area:aeroway"] selector to keep them while retaining the download-size win. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Generation now runs inside a dedicated rayon thread pool sized to a new 'CPU usage' setting (args.cpu_percent, default 90%, range 10-100). A scoped pool is used because rayon's global pool can only be built once per process (already built at startup), so this is the only way the setting can take effect per-run without an app restart. RAYON_NUM_THREADS still overrides. Exposed in the GUI settings as a 'CPU Usage' slider (10-100%, persisted to localStorage), wired through the gui_start_generation command. Lets users with spare cores push generation to 100% of cores instead of the previous hard-coded 90% cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Phase 2 (merging each tile's WorldToModify into the shared editor) is sequential, so during merges all worker cores sit idle — a ~20-30% Amdahl tail on large eviction-active worlds. Refactor the placement and merge halves of the tile loop into reusable closures (place_batch is a pure function of immutable inputs; merge_batch is the sole writer of the editor + eviction bookkeeping). Behind the opt-in ARNIS_PIPELINE_MERGE env flag, overlap batch N's serial merge with batch N+1's parallel placement via rayon::join. Merge order is unchanged (in-order, batch by batch), so output is bit-exact vs. the default path. Default behaviour is untouched (flag off = original serial place-then-merge). Validate the flagged path locally with --benchmark and ARNIS_BLOCK_HASH (the per-region content hash must match the unflagged run). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Apply rustfmt to the place_batch/merge_batch closures and silence the expected clippy::type_complexity on the merge_batch tile-result parameter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Expose the pipelined merge (previously ARNIS_PIPELINE_MERGE env only) as a GUI settings toggle so users don't have to launch from a terminal. Adds args.pipeline_merge (+ --pipeline-merge CLI flag); generation enables the pipeline when the toggle is on OR the env var is set. The toggle is persisted to localStorage so the choice sticks across launches. Default off. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Place the two performance controls above all settings sections (no category) so they're the first thing in the settings panel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UpmryD9UzEfMqj3yCq8Zoo
Contributor
Author
|
@louis-e |
Updated the PR benchmark workflow to save benchmark results to files and upload them as artifacts.
This workflow triggers on completion of the 'PR Benchmark' workflow, downloads benchmark results, and comments on the pull request with the results.
Contributor
Author
1 similar comment
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three independent improvements aimed at generating large areas faster, plus a small
follow-up fix. Only the Overpass query change affects default output; the new generation
feature is opt-in and defaults off.
1. Overpass: drop the unfiltered
way;selectorThe query included a bare
way;that pulled every way in the bbox (and all theirnodes), regardless of tags. The renderer only dispatches ways with recognised tags
(building / highway / landuse / …), which already have explicit selectors, and multipolygon
member ways are still fetched via
way(r.relsinbbox). The bare selector only added datathat gets discarded — a major source of oversized responses, timeouts, and the resulting
multi-server retry cascade on large areas.
nwr["area:aeroway"]selector, because the renderer handlesarea:aeroway(airport aprons / taxiway polygons), which previously rode in only via thebare
way;.2. CPU-usage control
Generation now runs in a dedicated rayon pool sized to a new setting (
cpu_percent,default 90%, range 10–100). A scoped pool is used because rayon's global pool can only
be built once per process, so this is the only way the setting can take effect per-run
without a restart. Exposed as a GUI "CPU Usage" slider and a
--cpu-percentflag;RAYON_NUM_THREADSstill overrides. Lets users push past the previously hard-coded 90% cap.3. Opt-in pipelined tile merge
Phase 2 (merging each tile into the shared editor) is sequential, so worker cores sit idle
during merges. Behind an opt-in toggle, batch N's merge now overlaps batch N+1's placement
via
rayon::join. Merge order is unchanged (in-order, batch by batch), so output isbit-exact vs. the default path. Enabled via a GUI "Faster merge" toggle, a
--pipeline-mergeflag, or the
ARNIS_PIPELINE_MERGEenv var; default off.Testing
cargo build --all-targets --all-features --release, clippy (-D warnings),and unit tests all pass.
the pipeline lowered the in-app ETA from ~9h39m to ~6h58m at the same progress point
(~28% faster). This is an observation, not a controlled benchmark — output equivalence
can be verified with
ARNIS_BLOCK_HASH=1(the per-region content hash should matchbetween the default and pipelined runs).
Notes