graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
test(gui): add mermaid as a GPU benchmark scenario
Rach Pradhanc53a2cfe0829
diff --git a/apps/native/electron/VISUAL-TESTS.md b/apps/native/electron/VISUAL-TESTS.mdindex 0c5d9666..9366d818 100644--- a/apps/native/electron/VISUAL-TESTS.md+++ b/apps/native/electron/VISUAL-TESTS.md@@ -32,14 +32,14 @@ bun run benchmark:desktop /absolute/baseline/apps/native /absolute/local-resultsbun run benchmark:desktop /absolute/candidate/apps/native /absolute/local-results/candidate```-The runner creates a fresh profile and uses synthetic code fences, long prose,+The runner creates a fresh profile and uses synthetic code fences, mermaid diagrams, long prose,and native wheel input. It measures renderer heap after collection, summedprocess RSS, script/layout work and frame callback intervals. Repeat both runsand compare matching scenarios. Keep the window visible on the same display;the runner retains production background throttling and hardware acceleration.RSS includes shared pages and is not an exclusive physical-memory measurement.-Set `GRAFF_BENCHMARK_TRACE=scroll` or `code` for a separate local Chromium trace.+Set `GRAFF_BENCHMARK_TRACE=scroll`, `code`, or `mermaid` for a separate local Chromium trace.Tracing adds memory overhead, so use untraced runs for RAM comparisons. Framecallbacks measure scheduling; verify presentation from trace display-feedbackand sequence counters before making refresh-rate claims. Keep reports and rawdiff --git a/apps/native/electron/performance-benchmark.cjs b/apps/native/electron/performance-benchmark.cjsindex 1f972a8d..7a88c701 100644--- a/apps/native/electron/performance-benchmark.cjs+++ b/apps/native/electron/performance-benchmark.cjs@@ -103,7 +103,7 @@ app.whenReady().then(async () => {};console.log('Benchmark: warmup');await send('warmup'); await sleep(1500);- const report = { workloadVersion: 1, build: fs.readFileSync(path.join(root, '.next/BUILD_ID'), 'utf8').trim(),+ const report = { workloadVersion: 2, build: fs.readFileSync(path.join(root, '.next/BUILD_ID'), 'utf8').trim(),runtime: { electron: process.versions.electron, chrome: process.versions.chrome },display: (() => { const display = screen.getDisplayMatching(win.getBounds()); return { frequencyHz: display.displayFrequency, scaleFactor: display.scaleFactor, window: win.getBounds() }; })(),acceleration: app.getGPUFeatureStatus(), accessibility: app.accessibilitySupportEnabled,@@ -115,6 +115,12 @@ app.whenReady().then(async () => {report.scenarios.push(await run(`code-${i}`, () => send('code')));if (i === 1 && process.env.GRAFF_BENCHMARK_TRACE === 'code') await contentTracing.stopRecording(path.join(output, 'code-trace.json'));}+ if (process.env.GRAFF_BENCHMARK_TRACE === 'mermaid') await startTrace();+ report.scenarios.push(await run('mermaid', async () => {+ await send('mermaid');+ await wait(`!!document.querySelector('[data-streamdown="mermaid-block"] svg')`);+ }));+ if (process.env.GRAFF_BENCHMARK_TRACE === 'mermaid') await contentTracing.stopRecording(path.join(output, 'mermaid-trace.json'));report.scenarios.push(await run('prose', () => send('prose')));const scroll = async () => {// Real wheel input exercises Chromium's scroll path, including main-thread listeners.@@ -125,7 +131,7 @@ app.whenReady().then(async () => {}};report.scenarios.push(await run('scroll', scroll));- if (process.env.GRAFF_BENCHMARK_TRACE && !['0', 'code'].includes(process.env.GRAFF_BENCHMARK_TRACE)) {+ if (process.env.GRAFF_BENCHMARK_TRACE && !['0', 'code', 'mermaid'].includes(process.env.GRAFF_BENCHMARK_TRACE)) {await startTrace();await scroll();await contentTracing.stopRecording(path.join(output, 'scroll-trace.json'));diff --git a/apps/native/electron/performance-workload.cjs b/apps/native/electron/performance-workload.cjsindex 54462237..e679187d 100644--- a/apps/native/electron/performance-workload.cjs+++ b/apps/native/electron/performance-workload.cjs@@ -9,6 +9,10 @@ function installPerformanceWorkload() {'\n\n- Keep the controls available.\n- Preserve the reading position.\n\n').join('');const code = '```typescript\n' + Array.from({ length: 300 }, (_, index) =>`export const sample${index} = (value: number) => value + ${index}; // sample row\n`).join('') + '```';+ const mermaid = Array.from({ length: 8 }, (_, i) =>+ '```mermaid\nflowchart TD\n' ++ Array.from({ length: 6 }, (_, j) => ` n${i}_${j}[Step ${i}.${j}] --> n${i}_${(j + 1) % 6}\n`).join('') ++ '```').join('\n\n');const json = value => new Response(JSON.stringify(value), { headers: { 'content-type': 'application/json' } });window.fetch = async (input, options) => {const url = new URL(typeof input === 'string' ? input : input.url, location.origin);@@ -17,8 +21,8 @@ function installPerformanceWorkload() {if (url.pathname === '/api/acp' && options?.body) {const body = JSON.parse(options.body);if (body.method === 'session/prompt') {- const text = window.benchmarkCase === 'prose' ? prose : window.benchmarkCase === 'code' ? code : 'Ready to review the workspace.\n\n```typescript\nconst ready = true;\n```';- const size = window.benchmarkCase === 'prose' ? 512 : window.benchmarkCase === 'code' ? 80 : 8;+ const text = window.benchmarkCase === 'prose' ? prose : window.benchmarkCase === 'code' ? code : window.benchmarkCase === 'mermaid' ? mermaid : 'Ready to review the workspace.\n\n```typescript\nconst ready = true;\n```';+ const size = window.benchmarkCase === 'prose' ? 512 : window.benchmarkCase === 'code' ? 80 : window.benchmarkCase === 'mermaid' ? 40 : 8;window.benchmarkChars = text.length;return new Response(new ReadableStream({ start(controller) {let index = 0;