Repository navigation
Conversation
…y search
filter_id_list, which intersects the ids of a tag lookup with the
candidates of the earlier ones, binary-searched every index entry of the
later key in the candidate list. For a common key such as highway that is
millions of searches, nearly all of which fail.
It now builds an Id_Bit_Filter of the candidates and skips entries whose
id the filter rejects; the binary search confirms the rest.
On a US northeast full-history extract (Geofabrik), warm cache, 4-core VM,
median CPU of 3 alternating runs:
[out:json][timeout:90]; (way["maxheight"]["highway"](39.0,-70.0,40.0,-69.0); way["bridge"]["maxheight"](39.0,-70.0,40.0,-69.0); way["tunnel"]["maxheight"](39.0,-70.0,40.0,-69.0); node["maxheight"]["highway"](39.0,-70.0,40.0,-69.0); ); out center;
0.33 s -> 0.21 s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01736kJWpJaGbt8ML6jz9N35
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 #1 (
faster-id-predicate), which addsId_Bit_Filter. The tables compare against #1's branch.Fixes #248.
Change
filter_id_list(the overload with indices,data/tags_global_reader.h) builds anId_Bit_Filterof the candidates when there are any, and skips index entries whose id the filter rejects. The binary search confirms the rest.One file, 12 lines added. No change to the database format, the query API or the results.
Impact
US northeast full-history extract (Geofabrik), warm cache, 4-core VM. Builds alternate, median user+sys CPU of 3 runs. The queries: the 1° × 1° maxheight query from #242 in three boxes (dense, sparse, empty) and their 0.99999° versions, and the 20 heaviest query templates on the public servers in June 2026 moved to Boston and New England coordinates (p01–p20). Base is #1's branch (70f18bd).
The gain is where a later key is looked up against candidates: p20 −80%, p12 −67%, the sparse and empty boxes about −35%. The increases (p05, p11, p14, p18) are noise: their instruction counts (valgrind callgrind, which repeats exactly) are unchanged to within 0.01%:
With #243, which drops candidates outside the query's ranges first, the candidate list is much shorter and this change matters more: on
all-changes+ #243 it takes dense_1 from 3.62 G to 2.54 G instructions.Queries
dense_1:
sparse_1:
empty_1:
The 0.99999° versions shrink each box's north and east edges by 0.00001°. p01 is dense_1.
p01 (maxheight bbox1deg)
p02 (amenities around union)
p03 (admin in area)
p04 (brands bbox ci)
p05 (global data center)
p06 (food around regex)
p07 (global seamark recurse)
p08 (global cameras)
p09 (3d buildings bbox)
p10 (tourism around25k)
p11 (brownfield bigbbox)
p12 (clinic name ci around25k)
p13 (map call meta)
p14 (area by name worship)
p15 (tiny bbox many keys geom)
p16 (hgv restrictions bbox)
p17 (anchored regex around)
p18 (fuel bigbbox)
p19 (venues bbox name ci)
p20 (office around25k)
Testing
fuzz,historyandpropsstarted by hand (workflow_dispatchwith this branch asref), since those workflows run on pull requests only againstmaster.Limitations and open questions
Generated by Claude Code