mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-02 21:01:21 +00:00
perf(floor): key the floor-geometry caches by the floor's content (#744)
The physical bodies, the wall union pool, the inner room contours and the clean floor carried the global config epoch in their keys. Every edit of any floor bumps it, so after one edit every other floor was cold again: in large-house the first visit to an untouched floor rebuilt its wall union and paid ~0.7 s flat / ~0.65 s 2.5D instead of ~40-55 ms. A floor's geometry reads only its own config record (spaceModels) and constants, so the key is now a content fingerprint of that record (src/floor-geometry-key.ts), remembered per epoch and per record object. The geometry also reads the current floor's config next to the model it is given; when those records differ the key covers both. The live resize preview is its own record, so preview frames get their own key; the editor runtime seeds the pool and re-keys the bodies through the same reader. The stairs editor no longer clears the clean floors of every floor: the stairs are part of the floor's record. The #735 switch-cycle guard now also sees the union pool and the inner contours (optional members of the large-house card contract, so an older comparison bundle reads 0). smoke_floor_geometry_cache proves the warm other floor and the invalidation against an independent card (multi-floor push with shared walls, a stair, a resize preview and its cancel); two mutants guard it. Issue: #744 User-Visible: yes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
This commit is contained in:
@@ -14178,6 +14178,29 @@ const MUTANT_DEFINITIONS = [
|
||||
+ ' controlTop: this.host._kiosk ? this.stage.controlTop : 0 });\n',
|
||||
}],
|
||||
},
|
||||
// #744: четыре кэша геометрии этажа — по отпечатку записи этажа, а не по эпохе.
|
||||
{
|
||||
id: 'floor-geometry-key-global-epoch',
|
||||
guard: 'node demo/smoke_floor_geometry_cache.mjs',
|
||||
because: '#744 AC1: an edit of one floor bumps the global epoch; a floor key made of the epoch '
|
||||
+ 'turns every other floor cold, and its first visit rebuilds the union, contours and clean floors',
|
||||
patches: [{
|
||||
file: 'src/floor-geometry-key.ts',
|
||||
find: ' const key = `${spaceId}|${contentFingerprint(model === current ? model : [model, current])}`;\n',
|
||||
replace: ' const key = `${spaceId}|${source._cfgEpoch}`; // mutant: the global epoch\n',
|
||||
}],
|
||||
},
|
||||
{
|
||||
id: 'floor-geometry-key-ignores-content',
|
||||
guard: 'node demo/smoke_floor_geometry_cache.mjs',
|
||||
because: '#744 AC2a: a server push that changes a floor\'s walls must give the floor a new key; a key '
|
||||
+ 'without the content fingerprint draws the walls and areas of the previous record',
|
||||
patches: [{
|
||||
file: 'src/floor-geometry-key.ts',
|
||||
find: ' const key = `${spaceId}|${contentFingerprint(model === current ? model : [model, current])}`;\n',
|
||||
replace: ' const key = `${spaceId}|`; // mutant: no content fingerprint\n',
|
||||
}],
|
||||
},
|
||||
];
|
||||
|
||||
const mutationCardSource = readFileSync(join(repoRoot, 'src/houseplan-card.ts'), 'utf8');
|
||||
|
||||
Reference in New Issue
Block a user