Repository navigation
perf(map): a level the display copy found saves too little isn't thinned again - #3013
Conversation
…ned again (opengeos#1227) A layer drawn zoomed in on Web Mercator first tries a display copy at the view's level. When that copy drops too few vertices it is refused, and the exact path then built the same level again from the same rows, only to refuse it for the same reason: a second pass over the whole layer for nothing. The display attempt now says why it made no level, and the exact path skips a level it found saves too little.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI read the full diff ( I found no bugs, security issues or performance regressions. The change does what the PR says, with one nit posted inline. Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base dde41e0 to PR head e46ad43).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
When a layer is drawn zoomed in on Web Mercator, it first tries to build a display copy at the view's level. If that copy drops fewer than
MIN_SAVINGof the vertices, it is refused. The exact path then built the same level again from the same rows (lod::project_budgeted) and threw it away for the same reason. That is a second pass over the whole layer for nothing.Now
lod::displayreturns why it made no level (Refused::UnfitorRefused::SavesTooLittle), and the layer keeps that reason with the refused attempt. When the exact path finds that the attempt for the same geometry revision, level and row count saved too little, it skips the copy and draws the full projection, as it did before after the second build was refused. This only applies to longitude/latitude rows on Web Mercator, where both builds count their saving against the same vertices.The drawn picture doesn't change: in both cases the full projection is drawn.
Timing
This is the benchmark's
render_viewcase from #1227: 100,000 buildings frompolygons.gpkg, a view of downtown Nashville,share.exportMapto PNG. Each figure is the median of interleaved runs of the wholerustgis-cli runthrough the host queue, againstmainwith #3008, on a shared box.In a profile of the loaded case, the discarded copy was about 0.05 s of the 0.12 s spent thinning and projecting. The loaded case's wall time barely moves, because that step overlaps with others there.
Memory
Nothing new is held. Each refused attempt keeps a small enum alongside it, in the existing list of
LEVELS_KEPTentries.Surfaces
The change is in
rustgis-map's display levels, so it reaches every place that draws a vector layer on a flat Web Mercator map: the desktop app, the browser, the phone, and map export from the command line, Python and the Assistant. No command, parameter or saved file changes.Testing
rejected_display_levels_are_not_rebuilt_on_unchanged_frames(extended incrates/map/src/lib.rs): it checks that the refused level is built only once and that the full projection is drawn. It also checks that a level no display attempt refused is still built bythinned_in. It fails without the fix.lodandLayertests, updated forResultin place ofOption.cargo fmt --all --check, and the full gate on the fork's CI on this commit.UI evidence
No visible UI change.
Related issue
Part of #1227.
Summary by CodeRabbit