feat(mapbench): map-architecture baseline benchmark harness (PR 1 of #229) #230

Merged
panda merged 1 commit from feat/mapbench-harness into main 2026-08-01 08:09:18 +02:00
Collaborator

Summary

First slice of the world-map migration (epic #229), on the agreed format-first, no-throwaway path. Before rewriting the map format, we need a reproducible measurement of the current dense-string[,] / whole-string architecture so we can (a) prove empirically where it hits a wall and (b) have a baseline the chunked format must beat. This PR adds that harness — it changes no format and no runtime behavior.

tools/IsoMmo.MapBench loads the real tile catalog, generates a deterministic synthetic map, and measures the actual load/edit/save pipeline exactly as the editor/server exercise it (parse text -> TileMap, TileMap -> MapModel, a local brush stroke, the full-map clone every dirty render/save triggers, a full WriteMap), then projects the numbers to the 13,344x9,984 = 133,226,496-cell target. Run it with just bench.

Key finding (this dev PC): a local 9x9 brush stroke is ~0 ms / 0 MB, but every dirty render clones the whole grid (~39.5 MiB at 2304x1728), and the target projects to multi-second monolithic ReadMap/WriteMap stalls and ~3 GiB of retained managed heap (three dense ref grids in flight) — not viable, which is exactly what motivates the chunked format in PR 2+.

Screenshots / recording

N/A — no visible surface (headless benchmark + a pure text generator). Per the epic #229 verification plan, screenshots begin at PR 3 (editor opening the 133M world).

How it was tested

  • 7 new unit tests (IsoMmo.MapBench.Tests) for the deterministic generator: same-seed byte-identical output, requested dimensions, different-seed divergence, zero-density -> empty statics/elevation, default-density -> non-empty, round-trips through the real TextMapFormat.ReadMap, empty-legends throws.
  • just bench runs end-to-end and prints the baseline table + projection (768x576 and 2304x1728 measured; 133M projected).
  • just lint (CSharpier + analyzers) clean — S1215 is disabled only in the bench project (with a written reason: a benchmark must force GC to isolate per-phase allocation).
  • Whole solution builds with 0 warnings / 0 errors; dotnet test fully green (incl. the 7 new tests).

DoD delta (beyond the base DoD + epic #229)

  • A reproducible current-architecture baseline exists and is runnable by anyone (just bench), measuring load/edit/save at 768x576 and 2304x1728 and projecting to 133,226,496 cells.
  • No format or runtime behavior change (the generator is a bench/test fixture, never authored content).

Checklist

  • just lint passes (CSharpier + analyzers, zero warnings)
  • just test is green
  • The whole solution builds (client and tools included)
  • Multi-platform preserved (pure managed .NET console tool, no OS-specific deps)
  • Tests added/updated for this change
  • Linked the related issue (#229) and its per-PR DoD is met
## Summary First slice of the world-map migration (epic #229), on the agreed **format-first, no-throwaway** path. Before rewriting the map format, we need a reproducible measurement of the **current** dense-`string[,]` / whole-string architecture so we can (a) prove empirically where it hits a wall and (b) have a baseline the chunked format must beat. This PR adds that harness — it changes no format and no runtime behavior. `tools/IsoMmo.MapBench` loads the real tile catalog, generates a deterministic synthetic map, and measures the actual load/edit/save pipeline exactly as the editor/server exercise it (parse text -> `TileMap`, `TileMap` -> `MapModel`, a local brush stroke, the full-map clone every dirty render/save triggers, a full `WriteMap`), then projects the numbers to the 13,344x9,984 = 133,226,496-cell target. Run it with `just bench`. Key finding (this dev PC): a local 9x9 brush stroke is ~0 ms / 0 MB, but **every dirty render clones the whole grid** (~39.5 MiB at 2304x1728), and the target projects to multi-second monolithic `ReadMap`/`WriteMap` stalls and **~3 GiB of retained managed heap** (three dense ref grids in flight) — not viable, which is exactly what motivates the chunked format in PR 2+. ## Screenshots / recording N/A — no visible surface (headless benchmark + a pure text generator). Per the epic #229 verification plan, screenshots begin at PR 3 (editor opening the 133M world). ## How it was tested - **7 new unit tests** (`IsoMmo.MapBench.Tests`) for the deterministic generator: same-seed byte-identical output, requested dimensions, different-seed divergence, zero-density -> empty statics/elevation, default-density -> non-empty, **round-trips through the real `TextMapFormat.ReadMap`**, empty-legends throws. - `just bench` runs end-to-end and prints the baseline table + projection (768x576 and 2304x1728 measured; 133M projected). - `just lint` (CSharpier + analyzers) clean — S1215 is disabled **only** in the bench project (with a written reason: a benchmark must force GC to isolate per-phase allocation). - Whole solution builds with **0 warnings / 0 errors**; `dotnet test` fully green (incl. the 7 new tests). ### DoD delta (beyond the base DoD + epic #229) - A reproducible current-architecture baseline exists and is runnable by anyone (`just bench`), measuring load/edit/save at 768x576 and 2304x1728 and projecting to 133,226,496 cells. - No format or runtime behavior change (the generator is a bench/test fixture, never authored content). ## Checklist - [x] `just lint` passes (CSharpier + analyzers, zero warnings) - [x] `just test` is green - [x] The whole solution builds (client and tools included) - [x] Multi-platform preserved (pure managed .NET console tool, no OS-specific deps) - [x] Tests added/updated for this change - [x] Linked the related issue (#229) and its per-PR DoD is met
feat(mapbench): map-architecture baseline benchmark harness (PR 1 of #229)
All checks were successful
ci / Lua content lint (pull_request) Successful in 10s
ci / Lint & Test (pull_request) Successful in 4m53s
aec2a43e8f
panda merged commit 4dd6139d90 into main 2026-08-01 08:09:18 +02:00
panda deleted branch feat/mapbench-harness 2026-08-01 08:09:19 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!230
No description provided.