Repository navigation
Conversation
Owner
Author
|
CI on this PR, against
Beyond the noise floor: q06_around −7.3%, t03_turbo_wizard_bbox −4.9%, t06_josm_wizard_bbox −3.9%, q08_out_meta −2.8%; t01_turbo_default +0.6% (floor ±0.5%) and a3_buildings_hrm +0.3% (floor ±0.2%), which this change doesn't plausibly slow. Generated by Claude Code |
Owner
Author
|
Re-measured p01 on a quieter machine (
So the 1.046 in the description was noise from other work running at the time; no slowdown. Generated by Claude Code |
Remove two redundant sorts, and add a guard to avoid a redundant sort in
some cases:
- generate_ids_by_coarse (both overloads) sorted each coarse index's ids
a second time, after already sorting them and removing duplicates.
- filter_ids_by_tags sorts the ids before checking each required key.
The first key's ids are always already sorted, so it now sorts only if
std::is_sorted says they aren't.
Geofabrik Nova Scotia extract, warm cache, 25 alternating pairs:
[out:json]; (node["shop"](44.45,-63.80,44.85,-63.40); node["amenity"](44.45,-63.80,44.85,-63.40); node["tourism"](44.45,-63.80,44.85,-63.40); ); out count;
638 ms -> 561 ms (-13%)
Co-Authored-By: Colin Dellow <cldellow@gmail.com>
cldellow
force-pushed
the
tags-late-sort-once
branch
from
November 25, 2026 20:04
dcac9f3 to
2f3159c
Compare
Owner
Author
|
Offered upstream in fossgis#15 |
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.
Fixes #175.
Change
generate_ids_by_coarse(core/type_tags.h, both overloads) no longer sorts each coarse index's ids a second time after sorting them and removing duplicates.filter_ids_by_tags(data/filter_ids_by_tags.h) sorts the ids for the first key it checks only if they aren't sorted yet (std::is_sorted, linear). They always are for the first key, which gets them fromgenerate_ids_by_coarse; later keys get ids pushed in tag entry order and still sort them.Two files, 3 lines added, 7 removed. No change to the database format, the query API or the results.
Impact
Late tag checks run when a statement's strategy is
prefer_ranges(bbox under 1 square degree,aroundunder 2 km, areas, input sets). Their candidates are every element in the search area, so large boxes and unions over the same box gain most.Production-shaped queries. The 20 heaviest query templates on the public servers in June 2026, moved to Boston and New England coordinates, on a US northeast full-history extract (Geofabrik). Current-date queries, warm cache, 4-core VM,
compare.py --paired --reps 10againstupstream/masterc3a20c0. Identical output on all 20; sum of median CPU −2%. Queries with a clear change:around:25000p01 (4 statements in a 1 × 1 degree box, which doesn't reach the changed code) first came out at 1.046 while other work ran on the machine; re-measured with 20 pairs on a quiet machine it is 0.995 (0.970–1.021).
A shorter query of the p04 kind, single runs (2.54, 2.52, 2.61 s on
upstream/master; 2.30, 2.20, 2.36 s with this PR):p04
Benchmark queries: the
timingworkflow runs them on this PR.Testing
upstream/master.out meta): identical output.fuzz,historyandpropsrun on this PR.Limitations
Generated by Claude Code