Repository navigation
Conversation
Get_Parent_Rels_Predicate and Get_Parent_Rels_Role_Predicate tested each
candidate relation through h.object(), which decodes it into a
Relation_Skeleton with its member and index vectors. They run on every
candidate of rel(bn) and rel(bw), and on every relation in the database for
rel(br), which scans them all; most candidates don't match.
has_a_child_with_id and has_a_child_with_id_and_role get overloads on the
stored form: members are 12 bytes each from byte 16, a 64-bit ref and then a
32-bit word with the role in its low 24 bits and the type in its high byte.
The predicates' Handle overloads for current relations use them, so only
matching relations are decoded.
On the Geofabrik France extract (--meta, lz4-compressed), warm cache, 4-core
VM, median CPU of 25 alternating runs:
[out:csv(::count)]; rel(48.8500,2.3300,48.8840,2.3650); rel(br); out count;
592 ms -> 532 ms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01736kJUqyDw9zM3Bkh2W2QT
Owner
Author
|
CI against Generated by Claude Code |
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 #276.
Change
Get_Parent_Rels_PredicateandGet_Parent_Rels_Role_Predicate(data/abstract_processing.h) tested each candidate relation throughh.object(), which decodes it into aRelation_Skeletonwith its member and index vectors. They run on every candidate ofrel(bn)andrel(bw), and on every relation in the database forrel(br), which scans them all (#277). Most candidates don't match.has_a_child_with_idandhas_a_child_with_id_and_roleget overloads on the stored form. Members are 12 bytes each from byte 16: a 64-bit ref, then a 32-bit word with the role in its low 24 bits and the type in its high byte, asRelation_Skeleton(void*)reads them. The predicates'Handle< Relation_Skeleton >overloads use them, so only matching relations are decoded. Attic relations keep the decoding path.One file, +30/−2. No change to the database format or the query API.
Impact
CPU time (user + system), warm cache, 4-core Intel Xeon VM (2.1 GHz), against
upstream/master555f744, alternating pairs; paired ratio with 95% CI. Output identical. France is the Geofabrik extract, Nova Scotia the 2026-11-08 extract, both imported with--metaand lz4-compressed maps. The VM had been restarted shortly before these runs, so absolute times are higher than in earlier PRs; the paired ratios are unaffected.upstream/master[out:csv(::count)]; rel(48.8500,2.3300,48.8840,2.3650); rel(br); out count;The JOSM-style template runs on the public servers about 1,760 times a day at about 5.7 s each. On France,
rel(br)is a small part of it: most of the 2.4 s is output (104 MB). On a planet database,rel(br)scans about ten times as many relations, so it should take a larger share there. Not measured.On the all-changes branch (#12), where output is already cheaper, the template is 0.932 (0.907–0.959) faster with this change.
Benchmark queries: sums of medians over 3 pairs, 0.99 on the plain set (21 queries) and 1.02 on the area set (16); none uses
rel(bn),rel(bw)orrel(br). Thetimingworkflow measures them properly.Testing
upstream/master555f744 on the queries above and on the 37 benchmark queries (Nova Scotia, 3 alternating pairs each).fuzz,history,propsandtimingrun on this PR.Limitations
rel(br)is reading and decompressing every relation; rel(br) reads every relation in the database #277 describes it. Fixing that needs a format change.Generated by Claude Code