You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collecting objects at a past date copies two block buffers per index #116
Queries at a past date ([date:], and the old side of [diff:]) collect objects through collect_items_by_timestamp in data/collect_items.h. For each index, it calls reconstruct_items twice, once for the current file and once for the attic file, and passes the end iterators by value.
A block iterator (Block_Backend_Basic_Iterator) owns a copy of the current block, and its copy constructor copies that whole buffer with memcpy. So every index costs two full buffer copies, whether or not anything there matches. Scans that walk many indexes therefore spend much of their time copying. Examples are member lookups (relation_node_members, way geometry) and the bbox filter on relations at a past date.
Profile of the query below on the all-changes branch (#12), Nova Scotia full-history database (see #2), warm cache: 33% of samples are in memcpy called from the block iterator's copy constructor, under collect_items_range for member nodes and ways.
[date:"2018-01-01T00:00:00Z"][out:xml]; rel(42,-67.6,47.5,-58); out body;
Fix
Pass the end iterators to reconstruct_items by const reference. The comparison operator is already const, and nothing else changes.
Activity
cldellow commentedon Nov 23, 2026
Offered upstream in fossgis#8