Repository navigation
⚡️ perf(rendering): cache render scenes per map layer - #79
Conversation
4499834 to
176e343
Compare
- Reuse cached layer geometry across visibility changes - Add selective layer-scene invalidation - Skip attribute reads and compute slow extents during geometry traversal - Cover cache reuse and update rendering documentation
176e343 to
53d78ad
Compare
Retain prepared snapshot storage, cache slow extents, and propagate driver capability allocation failures. Add owned flat polygon buffers, renderer adapters, regression coverage, and local validation results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pmeems
left a comment
There was a problem hiding this comment.
Automated review of the original PR head 53d78ad. Final decision is with the human reviewer.
All five findings below are fixed in f792c5a. The historical line comments document the defects and their fixes, not outstanding work. There were no existing comments to duplicate.
Recommendation: approve once CI passes. Risk: Medium because the user-approved flat-buffer redesign changes the native scene layout and caching increases memory use. Native clients must rebuild; COM contracts are unchanged.
Local Debug and Release CMake builds each ran 413 non-interactive cases with zero failures and three opt-in skips. MSBuild Debug built without warnings and its Core, GDAL initialization, and non-interactive ActiveX suites passed. Both Release rendering benchmarks ran at 100,000 features. All 35 renderer regression cases passed, including full-pixel equality after copying a flat scene and freeing its original buffers. The original 34 renderer cases also passed before changing storage.
The PR description contains sequential before/after timings and memory costs. Visibility hide/show assembly fell from approximately 5.08/10.00 seconds to 68.7/95.1 milliseconds. Initial preparation did not improve, and extra private memory rose from 169.4 to 466.1 MiB in the two-layer benchmark. Win32 and full-driver Release remain for CI; interactive registration and network checks were not run locally.
Finding counts: Critical 0, Major 2, Minor 3, Suggestion 0. Duplicates skipped: 0. Outstanding findings after the fixes: 0.
Resolve the shared plan checklist conflict while retaining both phase result sections. The merged Debug x64 build passed and CTest ran 419 cases with zero failures and three optional skips. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replaced by a newer auto-merge request
Summary
Implements phase 7 of
.github/plans/development-review-fix-plan-20261113.md.LayerId. Visibility changes retain geometry, hidden layers prepare when first shown, and removal or clearing releases the corresponding cache entries.MapView::InvalidateLayerScene()for selective refresh or retry.InvalidateScene()clears every layer cache.PolygonBuffer. Triangulation, GDI, and OpenGL read borrowed views without reconstructing nested vectors. The user approved this scope during local review.Local review
Reviewed every changed file in
.worktrees\pr-79. The branch already contained the latestdevelopmentcommit (77f7404), so merging the base required no new commit and produced no conflicts.Fixed the original tests'
unique_ptr/shared_ptrconversion errors and unused-variable warnings. Also fixed unnecessary snapshot reconstruction on prepared-layer insertion, an extra slow extent scan during loading, and termination on an allocation failure in the extent-capability probe. There were no existing review comments or unresolved threads when work began.Local validation
Windows, Visual Studio 18 Community, MSVC 14.52, x64:
x64-debug: build passed and CTest ran 413 cases with zero failures.x64-release: build passed and CTest ran 413 cases with zero failures.Debug | x64: solution build passed without warnings. Core passed 335 cases with one network case skipped, GDAL initialization passed all three cases, and ActiveX passed 71 non-interactive cases with two performance cases skipped./external:W0and/external:W4command-line options.Builds reused existing vcpkg dependencies without changing shared install trees. Local Release used the default driver set, not CI's
full-driversfeature set. Interactive COM registration/hosting and network tests were not run. Build configuration files did not change, so compile-command parity was not rerun.Before/after measurements
Sequential Release runs compare
developmentat77f7404with this implementation. Each run generated a GeoPackage containing 100,000 32-vertex polygons and a 256-byte string attribute. A map displayed two copies of that source layer. Visibility timings are medians of three operations and includeScene()assembly, but not drawing.Visibility changes avoid repeated reads and triangulation. Initial preparation did not improve in this run because triangulation still dominates. Prepared insertion now copies the new layer into its cache.
Compatibility and memory cost
VectorRenderScene::polygonschanges from nested vectors toPolygonBuffer. This changes the native structure layout: native clients must rebuild against the matching headers and Core DLL. StandalonePolygon,Ring, and their triangulation overload remain available. No COM interface, IID, CLSID, DISPID, or type-library version changes.MapRenderSceneremains an owning snapshot. Each layer cache owns another copy of coordinates and meshes, so the faster visibility path costs additional memory. Flat buffers reduce per-ring allocation overhead but do not remove snapshot copying.Failed layer diagnostics stay cached until invalidation. Duplicate map layers have independent caches even when they share one source. Invalidate each affected
LayerId, or invalidate the whole map after source edits.