From 563e4b57ba016cc0b613fa7470bd9e2677c7596f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 16:16:43 +0000 Subject: [PATCH] tag filters at a past date: don't add every candidate to the timestamp map Tag_Entry_Listener_Value_Regex::filter_ids keeps the candidates whose tag matched at the requested date. It looked each candidate up with timestamps[*it], and operator[] inserts a map entry for every candidate without a matching tag entry, only to reject it. For a cell of a common key that is a node allocation per candidate. It now uses find(); a candidate absent from the map is rejected as before. On a US northeast full-history extract (Geofabrik), warm cache, 4-core VM, median CPU of 3 alternating runs: [adiff:"2025-01-01T00:00:00Z","2026-11-01T00:00:00Z"]; (node["amenity"](42.2,-71.3,42.5,-70.9); way["building"](42.3,-71.15,42.4,-71.0); ); out geom; 16.68 s -> 15.36 s Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01736kJWpJaGbt8ML6jz9N35 --- src/overpass_api/data/filter_ids_by_tags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overpass_api/data/filter_ids_by_tags.h b/src/overpass_api/data/filter_ids_by_tags.h index afa2b24cb..d21b03804 100644 --- a/src/overpass_api/data/filter_ids_by_tags.h +++ b/src/overpass_api/data/filter_ids_by_tags.h @@ -216,8 +216,8 @@ struct Tag_Entry_Listener_Value_Regex : public Tag_Entry_Listener< Id_Type > std::vector< Id_Type > result; for (typename std::vector< Id_Type >::const_iterator it = new_ids.begin(); it != new_ids.end(); ++it) { - std::pair< uint64, uint64 >& timestamp_ref = timestamps[*it]; - if (0 < timestamp_ref.first && timestamp_ref.first <= timestamp_ref.second) + typename std::map< Id_Type, std::pair< uint64, uint64 > >::const_iterator found = timestamps.find(*it); + if (found != timestamps.end() && 0 < found->second.first && found->second.first <= found->second.second) result.push_back(*it); } std::sort(result.begin(), result.end());