perf: keep room contour cache out of editor previews
Issue: #322 User-Visible: no
@@ -51,6 +51,12 @@ await page.evaluate(async () => {
|
|||||||
await card.updateComplete;
|
await card.updateComplete;
|
||||||
});
|
});
|
||||||
await page.waitForFunction(() => window.__card.renderRoot.querySelectorAll('.rszhandle').length > 0);
|
await page.waitForFunction(() => window.__card.renderRoot.querySelectorAll('.rszhandle').length > 0);
|
||||||
|
// Entering Plan animates the editor chrome and stage for 220 ms. Reading a
|
||||||
|
// handle's screen CTM while that transition is still moving makes the real
|
||||||
|
// mouse click land at a stale coordinate and turns this pointer smoke flaky.
|
||||||
|
await page.waitForFunction(() => !window.__card._modeTransitionBusy);
|
||||||
|
await page.evaluate(() => new Promise((resolve) =>
|
||||||
|
requestAnimationFrame(() => requestAnimationFrame(resolve))));
|
||||||
|
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.__resizePointerId = null;
|
window.__resizePointerId = null;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 345 KiB After Width: | Height: | Size: 336 KiB |
|
Before Width: | Height: | Size: 335 KiB After Width: | Height: | Size: 327 KiB |
|
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 291 KiB |
|
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 290 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 134 KiB |
@@ -2,7 +2,7 @@
|
|||||||
"version": 1,
|
"version": 1,
|
||||||
"fixture": "synthetic-only",
|
"fixture": "synthetic-only",
|
||||||
"chromium": "151.0.7922.34",
|
"chromium": "151.0.7922.34",
|
||||||
"sourceFingerprint": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceFingerprint": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"captureScriptSha256": "ce2e9542fed9dade3085be87d16f69adb2ac8262893ad78ad966b1b9673f2983",
|
"captureScriptSha256": "ce2e9542fed9dade3085be87d16f69adb2ac8262893ad78ad966b1b9673f2983",
|
||||||
"command": "npm run build && node demo/docs/capture.mjs",
|
"command": "npm run build && node demo/docs/capture.mjs",
|
||||||
"scenarios": {
|
"scenarios": {
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "9190bd86a07b0cb0502019d76d3286c0542181e1b4a4f862077d9cefa120613c"
|
"imageSha256": "36223106c073f07d8cc3ecf8eaab37192ebb2687daba65c5c21047d0b7890de0"
|
||||||
},
|
},
|
||||||
"view-touch": {
|
"view-touch": {
|
||||||
"file": "02-view-touch.png",
|
"file": "02-view-touch.png",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "cfa2f77eb68df69ae9fc9b51ffe2f14df01f7b74444fd2b038cadc1e9dfee22b"
|
"imageSha256": "41e3ba67f8db0e98f26f484293af83ef937c369ca5ca6a59a3350d8954c906f4"
|
||||||
},
|
},
|
||||||
"space-create": {
|
"space-create": {
|
||||||
"file": "03-space-create.png",
|
"file": "03-space-create.png",
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "a86d4211af24923d5048e9094d0d35f9b28129394d00cd72582a8f8c2dd7ff75"
|
"imageSha256": "0dc024726327f60f4a9ceaf3044381691f81f1090af81d1812e870f22d9343ba"
|
||||||
},
|
},
|
||||||
"room-contour-close": {
|
"room-contour-close": {
|
||||||
"file": "04-room-contour-close.png",
|
"file": "04-room-contour-close.png",
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "c7effd4ccd19bcaff9138458583368aaab488dcb6fc7ea5ab766383cb5377ac4"
|
"imageSha256": "44cfaa95bd51e2cd628400e28db0ad8b2f0cd904385845bd402494f3f5c0d93c"
|
||||||
},
|
},
|
||||||
"plan-context-tray": {
|
"plan-context-tray": {
|
||||||
"file": "05-plan-context-tray.png",
|
"file": "05-plan-context-tray.png",
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "af1194f073f00b03af02b949a072cffb21bfd29995aa65a067eaaaec74ef8490"
|
"imageSha256": "e0662429b423fb74151b583dcc2c8635b001b637d03bbf7a6b16aec46399c3f8"
|
||||||
},
|
},
|
||||||
"device-editor": {
|
"device-editor": {
|
||||||
"file": "06-device-editor.png",
|
"file": "06-device-editor.png",
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "36ed21b66920ff2de9e3346cf6f27c67e64a9f81692599b9c70d8373f5eb7241"
|
"imageSha256": "d0ffd31ce80bfde21ab75da356a5fc1af38246f2b301030880320620c228d89d"
|
||||||
},
|
},
|
||||||
"device-display-preview": {
|
"device-display-preview": {
|
||||||
"file": "06-device-display-preview.png",
|
"file": "06-device-display-preview.png",
|
||||||
@@ -80,8 +80,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "7151c96dc048381f7a7070ecb85a82a890b2f4c703628f14fa472eb8dacbf3dc"
|
"imageSha256": "2cdabae1f89c3286e4fac0ce30f757ee1690b707ab8a5488748b7cd420626160"
|
||||||
},
|
},
|
||||||
"background-editor": {
|
"background-editor": {
|
||||||
"file": "07-background-editor.png",
|
"file": "07-background-editor.png",
|
||||||
@@ -91,8 +91,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "9f08f3f3711b100d68fb1a05af269e43e47d8f8d12c0cbe4f9ab557138722989"
|
"imageSha256": "30147bb00a90eea7136b4cee30995f6e6a9217b5132f3e8d3ad7471413b1af8a"
|
||||||
},
|
},
|
||||||
"room-card": {
|
"room-card": {
|
||||||
"file": "08-room-card.png",
|
"file": "08-room-card.png",
|
||||||
@@ -102,8 +102,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "66d8b0a509909822ff6b891a483bad9d2c72b20f08e287355883aa5205c6cee0"
|
"imageSha256": "029a3e69ec647a8a370d99e6bb7f9225833c526739076022f6b52ba54bff30ea"
|
||||||
},
|
},
|
||||||
"device-info": {
|
"device-info": {
|
||||||
"file": "09-device-info.png",
|
"file": "09-device-info.png",
|
||||||
@@ -113,8 +113,8 @@
|
|||||||
},
|
},
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sourceSha256": "80bd29ef9692067b706f221eaf8d62b4030e3a51b91bc9cff8d854aaee373700",
|
"sourceSha256": "f2df45c488a90c46b3483701e59600abbf3ba470aae7d9d7a17fd6e232f600f8",
|
||||||
"imageSha256": "83620033bb66edf7c804619261e4a62327049c178267f0837bd997627ffdc003"
|
"imageSha256": "dd492f53150b7149085daada5cce9eeae9bde9e7ea1d86679a54b3041f72f517"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11600,14 +11600,20 @@ class HouseplanCard extends LitElement {
|
|||||||
): number[][] | null {
|
): number[][] | null {
|
||||||
const cutsKey = openCuts.map((cut) => cut.join(',')).join(';');
|
const cutsKey = openCuts.map((cut) => cut.join(',')).join(';');
|
||||||
const key = `${space.id}|${this._cfgEpoch}|${roomId}|${cutsKey}`;
|
const key = `${space.id}|${this._cfgEpoch}|${roomId}|${cutsKey}`;
|
||||||
const cached = lruRead(this._innerContourCache, key);
|
// Editor previews can replace room polygons without advancing the saved
|
||||||
if (cached.hit) return cached.value;
|
// config epoch. Cache only the immutable View surface; otherwise a Resize
|
||||||
|
// drag would keep painting (and hit-testing) the pre-drag contour.
|
||||||
|
const cacheable = this._mode === 'view' && !this._rszPreview;
|
||||||
|
if (cacheable) {
|
||||||
|
const cached = lruRead(this._innerContourCache, key);
|
||||||
|
if (cached.hit) return cached.value;
|
||||||
|
}
|
||||||
const value = innerContourForRoom(
|
const value = innerContourForRoom(
|
||||||
space.rooms, roomId, this._spaceWalls, openCuts,
|
space.rooms, roomId, this._spaceWalls, openCuts,
|
||||||
this._wallKeyPitch, this._cellCm, this._gridPitch, NORM_W,
|
this._wallKeyPitch, this._cellCm, this._gridPitch, NORM_W,
|
||||||
roomWalls,
|
roomWalls,
|
||||||
);
|
);
|
||||||
lruWrite(this._innerContourCache, key, value, 600);
|
if (cacheable) lruWrite(this._innerContourCache, key, value, 600);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ test('room inner faces are structurally cached and shared by both fill layers',
|
|||||||
const helperEnd = source.indexOf('\n /**', helperStart);
|
const helperEnd = source.indexOf('\n /**', helperStart);
|
||||||
assert.ok(helperStart >= 0 && helperEnd > helperStart, 'inner-contour cache helper is present');
|
assert.ok(helperStart >= 0 && helperEnd > helperStart, 'inner-contour cache helper is present');
|
||||||
const helper = source.slice(helperStart, helperEnd);
|
const helper = source.slice(helperStart, helperEnd);
|
||||||
|
assert.match(helper, /const cacheable = this\._mode === 'view' && !this\._rszPreview;/);
|
||||||
assert.match(helper, /lruRead\(this\._innerContourCache, key\)/);
|
assert.match(helper, /lruRead\(this\._innerContourCache, key\)/);
|
||||||
assert.match(helper, /lruWrite\(this\._innerContourCache, key, value, 600\)/);
|
assert.match(helper, /lruWrite\(this\._innerContourCache, key, value, 600\)/);
|
||||||
|
|
||||||
|
|||||||