mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 23:57:23 +01:00
feat: Update sprint status and complete Epic 2 tasks
- Mark Epic 2 as done and update related stories to reflect completion. - Add Epic 2 retrospective document detailing team performance, metrics, and insights. - Enhance draw-relief-icons.ts to include parentEl parameter in drawRelief function. - Introduce performance measurement scripts for WebGL and SVG rendering comparisons. - Add benchmarks for geometry building in draw-relief-icons.
This commit is contained in:
parent
a285d450c8
commit
1c1d97b8e2
10 changed files with 1032 additions and 100 deletions
59
scripts/perf-ac7-sweep.mjs
Normal file
59
scripts/perf-ac7-sweep.mjs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
// AC7 detailed icon count comparison
|
||||
import {chromium} from "playwright";
|
||||
|
||||
async function measure() {
|
||||
const browser = await chromium.launch({headless: true});
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto("http://localhost:5173/Fantasy-Map-Generator/?seed=test-seed&width=1280&height=720");
|
||||
await page.waitForFunction(() => window.mapId !== undefined, {timeout: 90000});
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.evaluate(() => {
|
||||
window.WebGL2LayerFramework.init();
|
||||
if (window.generateReliefIcons) window.generateReliefIcons();
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const counts = [1000, 2000, 3000, 5000, 7000];
|
||||
for (const n of counts) {
|
||||
const result = await page.evaluate(
|
||||
count =>
|
||||
new Promise(res => {
|
||||
const full = window.pack.relief;
|
||||
const c = Math.min(count, full.length);
|
||||
if (c < count * 0.5) {
|
||||
res({skip: true, available: c});
|
||||
return;
|
||||
}
|
||||
window.pack.relief = full.slice(0, c);
|
||||
const el = document.getElementById("terrain");
|
||||
|
||||
const tSvg = performance.now();
|
||||
window.drawRelief("svg", el);
|
||||
const svgMs = performance.now() - tSvg;
|
||||
|
||||
el.innerHTML = "";
|
||||
if (window.undrawRelief) window.undrawRelief();
|
||||
|
||||
const tW = performance.now();
|
||||
window.drawRelief("webGL", el);
|
||||
requestAnimationFrame(() => {
|
||||
const wMs = performance.now() - tW;
|
||||
window.pack.relief = full;
|
||||
const pct = svgMs > 0 ? (((svgMs - wMs) / svgMs) * 100).toFixed(1) : "N/A";
|
||||
res({icons: c, svgMs: svgMs.toFixed(2), webglMs: wMs.toFixed(2), reductionPct: pct});
|
||||
});
|
||||
}),
|
||||
n
|
||||
);
|
||||
if (!result.skip) console.log(`n=${n}: ${JSON.stringify(result)}`);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
measure().catch(e => {
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue