Repository navigation
Conversation
Chunked output (tags_by_id, tags_by_id_attic) prints 1M nodes or 512k ways or relations at a time, and prefetch_chunk loads only that chunk's tags. It still kept the ids of the whole set, per coarse index, and filtered them by the chunk's id bounds while collecting. On a whole- province `out` of 12.6M nodes these lists were 145 MB of the peak. Generate them per chunk from the elements within the bounds instead. They then hold at most one chunk's ids, and the tag range query covers only the coarse indices that have elements in the chunk. Output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01736kJTiuJPoCWZs7RtFYjm
This was referenced Nov 22, 2026
cldellow
added a commit
that referenced
this pull request
Nov 23, 2026
One mutant for each of nine all-changes commits from the memory work: the past-date bbox chunking and its size check (#104), element counting in history collection (#87), the reserved and the 8-byte output references (#121, #150), in-place filtering (#130) and the Tag_Store changes (#128, #140). Each old text occurs once in all-changes at 686a701. The mutate workflow (run 45106469415, seeds 1-40) caught five: 1b30bbb, 0ec8fa9, 7b11467, f7274dc and 686a701. The other four are expected not to be caught, as their notes say: 7d39a64 and 1ef6664 change only memory, and 180c620 and 3f7cfa8 matter only for a query over [maxsize:]. Part of #145. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01736kJTiuJPoCWZs7RtFYjm
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.
Stacked on #128 (
tag-store-ids-once), which it targets: it replaces the lines #128 changed inprefetch_chunk. Review and merge #128 first.Fixes #139.
Change
outwith tags prints large sets in chunks of 1M nodes or 512K ways or relations, in id order, andTag_Store::prefetch_chunkcollects each chunk's tags. It kept the ids of the whole set, per coarse index, and filtered them by the chunk's id bounds while collecting. Now both overloads (current and attic) clear the lists and generate them per chunk, from the elements whose ids are within[lower_id_bound, upper_id_bound). Two new overloads ofgenerate_ids_by_coarse(core/type_tags.h) take the bounds. They also skip the second, redundant sort of the existing ones. The bounds checks already incollect_tags_framedand the framedcollect_attic_tagsstay. They are now redundant but harmless.A side effect: each chunk's tag range query covers only the coarse indices that have elements in that chunk.
Two files, 61 lines added and 8 removed. This doesn't change the query API, the on-disk format or
[maxsize:]accounting (the tag store was never counted). Output is unchanged.Bound: the lists hold at most one chunk's ids: 1M × 8 bytes for nodes, 512K × 16 bytes for attic ways or relations. Cost: one pass over the set per chunk to pick out the chunk's ids.
Impact
Warm cache, 4-core cloud VM with 15 GB RAM. Outputs are byte-identical everywhere. Databases: the Geofabrik Nova Scotia extract of 2026-11-08 imported with
--meta(plain), and a Nova Scotia full-history extract (2006 to 2026-11-15) imported with--keep-atticby abetter-importsbuild (history). Both use lz4 compression.Queries
[out:xml]; node(42,-67.6,47.5,-58); out;[out:xml]; way(42,-67.6,47.5,-58); out;[out:json]; way[highway]; out geom;[out:xml]; rel(42,-67.6,47.5,-58); out body;[out:json]; nwr[name]; out center;[date:"2018-01-01T00:00:00Z"][out:xml]; node(42,-67.6,47.5,-58); out;[date:"2018-01-01T00:00:00Z"][out:xml]; way(42,-67.6,47.5,-58); out meta;[date:"2018-01-01T00:00:00Z"][out:json]; way[highway]; out geom;[date:"2018-01-01T00:00:00Z"][out:json]; nwr[name]; out center;[date:"2018-01-01T00:00:00Z"][out:xml]; rel(42,-67.6,47.5,-58); out body;Against #128
CPU is the median of alternating runs (
bench/compare.py --no-cache): 7 for P2 and W1, 5 for the other plain queries, 3 for history. Peak RSS is from one extra run under GNU time (--rss).Benchmark queries q01–q12 (7 runs): total CPU 2,449 → 2,445 ms (×1.00), RSS within 0.3 MB on each. History benchmark h1–h6 (5 runs): total ×1.03, RSS within 0.3 MB on each; none of them prints more than one chunk, so this is noise. The queries are defined in #2 and #12.
On
all-changes(at 1ef6664, which includes #128), without and with this commitOne run of each under GNU time.
Testing
all-changes, and on q08 and q12 (out metawith tags).upstream/master(8edf11b), seed 1, no differences:fuzzrun 45112559027: plain 1,990 same and 10 skipped,areas,complete1,999 and 1,evaluators1,998 and 2. Skipped means a timeout or resource limit, which isn't compared.historyrun 45109181378,history,users,complete: 998 same, 2 skipped.propsrun 45109200659, 60 seeds: no new failures. The 9 checks that fail also fail onupstream/master.all-changes(7b11467 in Mutants for the memory commits on all-changes #153) is caught by 10 property checks.print.ccalready passes: the first id of the chunk, and the first id of the next chunk (or the last id plus one). They are always set, so the "no bound" case of the framed collectors never applies.Limitations
print.ccalready holds. That would need a differentprefetch_chunksignature, so it isn't done here.🤖 Generated with Claude Code
https://claude.ai/code/session_01736kJTiuJPoCWZs7RtFYjm