Skip to content

perf: rasterise Danseiji base maps without walking the edge per pixel - #48

Merged
nighthawk merged 1 commit into
feat/svg-single-image-base-mapfrom
perf/danseiji-raster
Oct 28, 2026
Merged

nighthawk merged 1 commit into
feat/svg-single-image-base-mapfrom
perf/danseiji-raster

Conversation

@nighthawk

Copy link
Copy Markdown
Member

Stacked on #46. Maparoni's MCP tools now offer the Danseiji projections (maparoni/lambdaroni#290). A Danseiji IV render on Blue Marble took about 15 s on lambdaroni-dev, and the same render on street tiles hit Phoenix's 15 s timeout.

The time went into Danseiji's 388-vertex edge polygon, which was walked twice for every output pixel. The sampler walked it to check the map bounds, then Danseiji's inverse walked it again. A 1200 px render is about a million pixels, and the Lambda's 512 MB gets a fraction of a vCPU.

  • Map bounds. MapBounds.crossings(atY:) gives a polygon boundary's crossings for one row. The samplers compute these once per row and test each pixel against them. Every polygon-bounded projection benefits.
  • Danseiji's inverse. It tests its edge through an InsideGrid, a 128×128 grid that knows which cells are inside, outside or on the edge. Only the edge cells walk the polygon.

Danseiji IV's bounds check plus inverse over 1.25M points took 1.35 s before and 0.07 s after, single-threaded on an M-series Mac.

Testing: swift test. New tests check that the grid and the row crossings agree with the full polygon walk on random points. That covers all six Danseiji edges, including points nudged onto the edge itself.

🤖 Generated with Claude Code

- MapBounds.crossings(atY:) gives where a polygon boundary crosses a
  row; the tile and single-image samplers test each row's pixels against
  it instead of walking the polygon per pixel
- Danseiji's inverse tests its edge through a precomputed InsideGrid;
  only cells the edge crosses walk the polygon
- Danseiji IV bounds plus inverse over 1.25M points: 1.35 s to 0.07 s
  on an M-series Mac, single-threaded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nighthawk
nighthawk merged commit 549158a into feat/svg-single-image-base-map Oct 28, 2026
@nighthawk
nighthawk deleted the perf/danseiji-raster branch October 28, 2026 00:47
nighthawk added a commit that referenced this pull request Oct 28, 2026
…#48)

- MapBounds.crossings(atY:) gives where a polygon boundary crosses a
  row; the tile and single-image samplers test each row's pixels against
  it instead of walking the polygon per pixel
- Danseiji's inverse tests its edge through a precomputed InsideGrid;
  only cells the edge crosses walk the polygon
- Danseiji IV bounds plus inverse over 1.25M points: 1.35 s to 0.07 s
  on an M-series Mac, single-threaded

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant