Context
Part of #21 (live GeoMapSheet draft-tile persistence + Cartesian→geographic migration).
The migrated publish path (geoMapSheetToGridMap in grid_projection.cpp)
iterates each grid's cells via GeoGrid::values(), which returns a dense
std::vector<DepthAndUncertainty> in CellAreaIterator order (up to
960×960 ≈ 920k entries per grid), NaN-filled for empty cells.
Problem
On each publish cycle the node:
- allocates a dense
values() vector per grid (most cells typically NaN for a
sparse survey patch), and
- walks the full dense set, running residual per-cell lat/lon→ECEF trig only on
the finite cells but still paying the allocation + full-length scan.
At GGGS scale on the live publish cadence this is heavier than necessary. The
per-cell ECEF conversion is also the residual cost the plan-review flagged once
the per-cell TF lookup was removed.
Proposed fix
- Provide / use a sparse accessor that yields only populated
(CellIndex, DepthAndUncertainty) pairs, avoiding the dense allocation and full scan.
- Optionally hoist the ECEF conversion or precompute per-row factors where the
longitudinal span is constant within a grid.
Acceptance
- Publish-path allocation no longer scales with total cell count, only with
populated cells.
- A micro-benchmark or timed test showing reduced per-publish cost on a
representative survey patch; published grid output unchanged (equivalence test
still green).
Authored-By: Claude Code Agent
Model: Claude Opus 4.8
Context
Part of #21 (live GeoMapSheet draft-tile persistence + Cartesian→geographic migration).
The migrated publish path (
geoMapSheetToGridMapingrid_projection.cpp)iterates each grid's cells via
GeoGrid::values(), which returns a densestd::vector<DepthAndUncertainty>inCellAreaIteratororder (up to960×960 ≈ 920k entries per grid), NaN-filled for empty cells.
Problem
On each publish cycle the node:
values()vector per grid (most cells typically NaN for asparse survey patch), and
the finite cells but still paying the allocation + full-length scan.
At GGGS scale on the live publish cadence this is heavier than necessary. The
per-cell ECEF conversion is also the residual cost the plan-review flagged once
the per-cell TF lookup was removed.
Proposed fix
(CellIndex, DepthAndUncertainty)pairs, avoiding the dense allocation and full scan.longitudinal span is constant within a grid.
Acceptance
populated cells.
representative survey patch; published grid output unchanged (equivalence test
still green).
Authored-By:
Claude Code AgentModel:
Claude Opus 4.8