Repository navigation
Conversation
Set_Comparison builds a Node_, Way_ or Relation_With_Context for every
element of a diff. Their constructors took tags (and, for ways and
relations, geometry) by value or const reference and copied them into the
member. The callers pass "tags ? *tags : std::vector<...>()", a temporary
copy, so each element's tags and geometry were copied twice.
The constructors now take tags and geometry by value and move them into
the members, so the temporary moves in and each is copied once.
On a US northeast full-history extract (Geofabrik), instruction counts
(valgrind callgrind) against master:
[diff:"2024-01-01T00:00:00Z","2026-11-01T00:00:00Z"]; way["highway"](42.34,-71.08,42.36,-71.05); out geom;
7.901 G -> 7.881 G (-0.25%)
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 #217.
Change
Node_With_Context,Way_With_ContextandRelation_With_Context(data/diff_set.h) take tags and geometry by value andstd::movethem into their members. The callers'x ? *x : T()temporaries now move in, so each element's tags and geometry are copied once instead of twice.One file, 7 lines added, 5 removed. No change to the database format, the query API or the results.
Impact
Verdict: no measurable gain. The copies are real, but against the rest of a diff (reading two versions of every element, attic reconstruction, output) they are a fraction of a percent.
US northeast full-history extract (Geofabrik), warm cache, 4-core VM, base build
upstream/mastera9d8f15.Instruction counts (valgrind callgrind, user-space instructions for the whole run). These repeat exactly between runs of the same build for these queries, so differences well under 1% are real. (p15 of the production set is left out: its count varies by 20% between identical runs.)
CPU time. Base and patched builds run alternately, 3 times each; median user+sys CPU per query. Run-to-run noise is about ±4% per query and ±2% on a total, so small changes don't show here.
Peak memory is unchanged (within 1 MB on every query). Identical output on all queries.
Small queries for instruction counts
s_d1_adiff_small
s_d2_diff_highways_small
s_d4_diff_convert_small
s_m1_meta_amenity_small
s_m3_attic_meta_small
Diff queries d1–d4
d1_adiff_amenity_buildings
d2_diff_highways
d3_adiff_routes
d4_diff_convert
Testing
upstream/masteron the 7 diff queries above.fuzz,historyandpropsrun on this PR.Limitations and open questions
diff/adiff. Closing it is also reasonable.Generated by Claude Code