Repository navigation
Conversation
|
CI on this PR, against
Beyond the noise floor: q04_bbox_tag −32.5%, q10_out_geom_highways −9.1%, t04_turbo_cycle_network −8.8%, q08_out_meta −3.4%, t03_turbo_wizard_bbox −3.0%, t06_josm_wizard_bbox −2.7%, t10_osmdata_bbox −2.0%, q09_out_geom_buildings −0.6%; t01_turbo_default +0.6% (floor ±0.5%). Generated by Claude Code |
|
Paired runs on the 20 production-shaped queries (the public servers' heaviest templates of June 2026, moved to Boston and New England), US northeast full-history extract (Geofabrik), current-date queries, warm cache, 4-core VM,
The others don't filter ways by a large bbox and are within noise (B/A 0.97–1.05, every CI including 1). Generated by Claude Code |
b0f2976 to
b4e849b
Compare
|
Offered upstream in fossgis#22 |
To test ways against a bbox, Bbox_Filter loads the nodes of every
candidate way and checks its segments. It uses a fast path to exclude
ways that must lie outside of the bbox by virtue of their enclosing
tile. Extend the fast path to ways that must lie inside the bbox by
virtue of their enclosing tile.
On a Nova Scotia extract:
[out:csv(::count)]; way[highway](44.60,-63.66,44.70,-63.52); out count;
112 ms -> 74 ms (-34%)
[out:json]; way[highway](44.60,-63.66,44.70,-63.52); out geom;
396 ms -> 333 ms (-16%)
Co-Authored-By: Colin Dellow <cldellow@gmail.com>
b4e849b to
547cb6e
Compare
Fixes #181.
Change
Bbox_Filter::filter(const Statement&, Resource_Manager&, Set&)(data/bbox_filter.cc) now moves aside the current ways whose index area lies inside the bbox before it builds theWay_Geometry_Store, and puts them back after filtering the rest. A newcontains_index_areatakes the index's south-west and north-east node tiles fromcalc_bbox_boundsand compares their extreme coordinates with the bbox. It returns false for bboxes that cross the antimeridian or span 180 degrees or more, whereBbox_Double::intersectswraps longitudes.Why this keeps the results: every node of a way lies in the area of its index. If that area is inside the bbox, so are the way's nodes; a way with one node is then contained, and any segment with both ends inside intersects. Without wrapping,
Bbox_Filter::matchesreturns true for both.Attic ways and relations are unchanged. One file, 29 lines added, 1 removed. No change to the database format or the query API.
Impact
US northeast full-history extract (Geofabrik), current-date queries, warm cache, 4-core VM, against
upstream/masterc3a20c0. Single runs (identical output); paired runs will follow in a comment.upstream/master[key](bbox)statements, 1.65 × 3.58 degree box,out geom(below)out centerout geomout center[out:json][maxsize:4000000000]; way(41.5,-74,43.5,-70.5); out count;peak RSSSmall boxes (p09, p19) show no change. The memory saving comes from not holding the geometry of the inside ways; queries with
out geomstill load it once for output.Benchmark queries: the
timingworkflow runs them on this PR.Testing
way[highway],way[building],way[waterway],way[natural=water]andway(count) in ten boxes from 0.0001 degrees to 7 × 13 degrees, in Boston, New York, Maine, Vermont and on tile boundaries. 49 identical. The last,[out:json][maxsize:4000000000]; way(40.5,-80,47.5,-67); out count;, runs out of memory onupstream/master("Query run out of memory using about 8653 MB of RAM", as the way geometry isn't counted towards[maxsize:]), and returns 19,560,764 ways with this PR, which doesn't build the geometry of the ways inside the box.fuzz,historyandpropsrun on this PR.Limitations
aroundand polygon filters; not done here.Generated by Claude Code