Repository navigation
Conversation
…p map
Tag_Entry_Listener_Value_Regex::filter_ids keeps the candidates whose
tag matched at the requested date. It looked each candidate up with
timestamps[*it], and operator[] inserts a map entry for every candidate
without a matching tag entry, only to reject it. For a cell of a common
key that is a node allocation per candidate.
It now uses find(); a candidate absent from the map is rejected as before.
On a US northeast full-history extract (Geofabrik), warm cache, 4-core VM,
median CPU of 3 alternating runs:
[adiff:"2025-01-01T00:00:00Z","2026-11-01T00:00:00Z"]; (node["amenity"](42.2,-71.3,42.5,-70.9); way["building"](42.3,-71.15,42.4,-71.0); ); out geom;
16.68 s -> 15.36 s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01736kJWpJaGbt8ML6jz9N35
This was referenced Nov 26, 2026
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 #236.
Change
Tag_Entry_Listener_Value_Regex::filter_ids(data/filter_ids_by_tags.h) looks candidates up withfind()instead ofoperator[]. A candidate absent from the map has no matching tag entry and is rejected, as the zero-initialised entryoperator[]created was.One file, 2 lines changed. No change to the database format, the query API or the results.
Impact
Mostly CPU. The map lives for one cell at a time, so peak memory doesn't move.
US northeast full-history extract (Geofabrik), warm cache, 4-core VM. Builds run alternately; peak RSS and median user+sys CPU of 3 runs per query. Run-to-run CPU noise is about ±4% per query. Base is
upstream/mastera9d8f15.Instruction counts (valgrind callgrind; these repeat exactly between runs). They are smaller than the wall-time gains: the saved work is mostly allocation and cache misses, which instruction counts underweight.
On
all-changesthe same change took total CPU over the 7 queries from 43.7 to 39.6 s (d1 −20%, d4 −16%), on a run where the machine also built another tree, so treat that as indicative.Queries
d1 (adiff amenity buildings)
d2 (diff highways)
d3 (adiff routes)
d4 (diff convert)
h2 (attic way geom)
h8 (attic amenity meta)
m3 (attic meta highways)
s_d1_adiff_small (d1 adiff small)
s_d4_diff_convert_small (d4 diff convert small)
s_m3_attic_meta_small (m3 attic meta small)
Testing
upstream/masteron all 7 queries above.fuzz,historyandpropsrun on this PR.Limitations and open questions
eval_idin the same listener and inTag_Entry_Listener_Key_Regexstill insert withoperator[], but only for tag entries of the wanted key, which is what the map is for.Generated by Claude Code