fix(simulation): pre-build the true-keyed region cache (PR #199 review)
Hoshe finding 1: derive_all_districts passed a permanently-empty region_cache, so every survey cell paid four on-the-fly baseline derivations — and derive_district_profile's docstring (build the cache before calling in a loop) was contradicted by its sole production caller. The cache is now pre-built on the TRUE region keys the shared core looks up (survey-cell centre metres -> containing district -> region ±1 ring, BTreeSet-deduped), restoring the per-body build-once cost model. Cache-hit == cache-miss byte-identity holds by D-227 purity (build_region_profile and the miss branch share the same expressions) — verified by the believability harness passing against the UNCHANGED golden. Finding 2: the cascade.rs call-site comment and the stale module header now state the pre-build truthfully. Found in passing, filed as T-1186 (pre-existing, out of scope here): region_centre_latitude_deg is pole-anchored while the derive core keys equator-anchored signed regions — northern-hemisphere baselines clamp to +90. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -306,8 +306,10 @@ pub fn run_cascade_from_heightmap(
|
||||
// shared via scale::HEIGHTMAP_CELLS_PER_DISTRICT so plugin.rs
|
||||
// converts CityPlacement pixel coords with the same constant.
|
||||
// body_id is required for the D-243 §4 climate edge-fuzz warp
|
||||
// domain separation — derive_all_districts builds the region
|
||||
// cache internally.
|
||||
// domain separation — derive_all_districts pre-builds the
|
||||
// region-baseline cache internally on TRUE region keys (each
|
||||
// survey cell's centre world metres → containing district →
|
||||
// region ±1 ring; D-256(c) + PR #199 review).
|
||||
//
|
||||
// Layer1Output.survey_basin_dirs threads the true D8 thalweg
|
||||
// direction into each DistrictProfile.basin_direction (T-1047)
|
||||
|
||||
Reference in New Issue
Block a user