[58] projectToModel3d über Änderungs-Antworten: TS liest nur neue Wand-Einträge, Bench kalt/unverändert/nach Änderung

This commit is contained in:
Claude committed 2026-11-05 03:47:08 +00:00
1 parent 478b65188d
commit 75a1e896a2
4 files changed
+167 -8

No files matched your search

+14 -4
View File
@@ -850,7 +850,16 @@ async function execute(project: Project, file: string, command: string, rest: st
await time("planToRenderScene", () => planToRenderScene(plan));
await time("planToSvgString", () => planToSvgString(plan, { scaleDenominator: scale }));
}
await time("projectToModel3d", () => projectToModel3d(project));
{
// Erstes Mal auf einem frischen Dokument (ohne Cache, [58]); die Zeile darunter misst die Wiederholung.
const cold = structuredClone(project);
withDocument(cold, () => {
const t0 = performance.now();
projectToModel3d(cold);
rows.push(["projectToModel3d (kalt)", performance.now() - t0]);
});
}
await time("projectToModel3d (unverändert)", () => projectToModel3d(project));
if (sec) await time("Schnitt (Kern)", async () => generateSectionPlan((await computeSection(project, sec))!, false, { visibleCodes: allCodes }), Math.max(3, runs / 2));
if (elev) await time("generateElevationPlan", () => generateElevationPlan(project, elev), Math.max(3, runs / 2));
if (project.walls.length) {
@@ -888,11 +897,12 @@ async function execute(project: Project, file: string, command: string, rest: st
const r = doc.commit(cur, opsFor({ ...cur, walls: cur.walls.slice(0, 1) } as Project, 0.01 * ++k).slice(0, 1), undefined, Date.now());
if ("project" in r) cur = r.project;
}, runs * 5);
// [58] Inkrementelle 3D-Ableitung: eine Änderung, dann das ganze 3D-Modell neu abfragen.
// [58] Inkrementelle 3D-Ableitung (Cache im Dokument, Änderungs-Antworten): eine Änderung, dann das ganze
// 3D-Modell neu abfragen; zum Vergleich die volle Abfrage ohne Cache-Weg in TS.
lap("projectToModel3d (Dokument)", () => projectToModel3d(cur));
lap(" davon Kern (model3dParts)", () => doc.queryJson("model3dParts", [1, 2, 0, 0, 0]));
lap(" model3dParts voll: Kern (JSON)", () => doc.queryJson("model3dParts", [1, 2, 0, 0, 0]));
const partsJson = doc.queryJson("model3dParts", [1, 2, 0, 0, 0]);
lap(" davon JSON.parse", () => JSON.parse(partsJson));
lap(" model3dParts voll: JSON.parse", () => JSON.parse(partsJson));
lap("projectToModel3d nach 1 Wand-Änderung", () => {
const w = cur.walls[++k % cur.walls.length];
const r = doc.commit(cur, patchItem(cur, "walls", w.id, { height: (w.height ?? 2.6) + (k % 2 ? 0.01 : -0.01) }), undefined, Date.now());