You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/13 08:46:36 UTC
(maka) branch perf/scroll-paired-20260913 created (now a5e4f2a905)
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a change to branch perf/scroll-paired-20260913
in repository https://gitbox.apache.org/repos/asf/maka.git
at a5e4f2a905 test(perf): pair scroll variants on one runner with lightweight probes
This branch includes the following new commits:
new a5e4f2a905 test(perf): pair scroll variants on one runner with lightweight probes
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
(maka) 01/01: test(perf): pair scroll variants on one runner with lightweight probes
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch perf/scroll-paired-20260913
in repository https://gitbox.apache.org/repos/asf/maka.git
commit a5e4f2a905b393eb1261b2a92cdaabeb7fd7b54a
Author: AstroHan <le...@outlook.com>
AuthorDate: Sun Sep 13 16:46:24 2026 +0800
test(perf): pair scroll variants on one runner with lightweight probes
---
.github/workflows/performance-frontend.yml | 21 +++-------
scripts/perf/playwright.config.ts | 2 +-
scripts/perf/scroll-input.spec.ts | 48 +++++++++++-----------
scripts/perf/scroll-paired.mjs | 64 ++++++++++++++++++++++++++++++
4 files changed, 94 insertions(+), 41 deletions(-)
diff --git a/.github/workflows/performance-frontend.yml b/.github/workflows/performance-frontend.yml
index 529b913467..62fa5df756 100644
--- a/.github/workflows/performance-frontend.yml
+++ b/.github/workflows/performance-frontend.yml
@@ -23,35 +23,26 @@ permissions:
jobs:
measure:
runs-on: ubuntu-24.04
- timeout-minutes: 35
+ timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
- node-version: '24.18.1'
+ node-version: "24.18.1"
cache: npm
- run: npm ci
- run: npm --workspace @maka/desktop run build:workspace-deps
- run: npm --workspace @maka/desktop run build
- - run: npm --workspace @maka/desktop run build-storybook
- id: browsers
run: npx playwright install --with-deps chromium
- - name: Electron and Host measurements
- working-directory: apps/desktop
+ - name: Fetch exact experiment sources
+ run: git fetch --depth=1 origin 839d14535a541ef0da29ea4d6626a2e3d0e32a8e 0039a230754a4bd832653f481194fb40516464db
+ - name: Paired A-B-B-A-A-B real Host scroll measurements
env:
MAKA_PERF_OUTPUT: ${{ github.workspace }}/perf-results
- run: xvfb-run -a npx playwright test --config ../../scripts/perf/playwright.config.ts
- - name: Storybook measurements
- if: ${{ !cancelled() && steps.browsers.outcome == 'success' }}
- run: xvfb-run -a node scripts/perf/storybook.mjs
- - name: Fixed-range layout ablation
- if: ${{ !cancelled() && steps.browsers.outcome == 'success' }}
- run: xvfb-run -a node scripts/perf/geometry-ablation.mjs
- - name: Known-space scroll experiment
- if: ${{ !cancelled() && steps.browsers.outcome == 'success' }}
- run: node scripts/perf/scroll-window.mjs
+ run: xvfb-run -a node scripts/perf/scroll-paired.mjs
- name: Upload raw measurements and diagnostics
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
diff --git a/scripts/perf/playwright.config.ts b/scripts/perf/playwright.config.ts
index 8342443c14..d824d20312 100644
--- a/scripts/perf/playwright.config.ts
+++ b/scripts/perf/playwright.config.ts
@@ -26,5 +26,5 @@ export default defineConfig({
timeout: 180000,
captureGitInfo: { commit: false, diff: false },
outputDir: '../../perf-results/playwright',
- use: { trace: 'on' },
+ use: { trace: process.env.MAKA_PERF_PAIRED ? 'off' : 'on' },
});
diff --git a/scripts/perf/scroll-input.spec.ts b/scripts/perf/scroll-input.spec.ts
index f557fa67a7..14f6136263 100644
--- a/scripts/perf/scroll-input.spec.ts
+++ b/scripts/perf/scroll-input.spec.ts
@@ -36,13 +36,11 @@ test('dense upward input with real Host history', async () => {
e2eFixtureScenario: 'chat-prompt-rail',
locale: 'zh-CN',
showWindow: true,
- tracePath: path.join(outputDir, 'scroll-input.trace.zip'),
},
async (page) => {
await page.setViewportSize({ width: 1352, height: 932 });
const cdp = await page.context().newCDPSession(page);
const browser = await cdp.send('Browser.getVersion');
- await cdp.send('Profiler.enable');
for (let trial = 0; trial < 3; trial++) {
await page.reload();
await expect(page.locator('[data-turn-id="turn-prompt-rail-120"]')).toHaveCount(1);
@@ -67,6 +65,7 @@ test('dense upward input with real Host history', async () => {
running: true,
phase: 'input',
frames: [] as any[],
+ ranges: [] as any[],
events: [] as any[],
tasks: [] as any[],
});
@@ -81,36 +80,39 @@ test('dense upward input with real Host history', async () => {
for (const type of ['wheel', 'scroll', 'scrollend'])
root.addEventListener(
type,
- () =>
- p.events.push({ type, ms: performance.now(), phase: p.phase, top: root.scrollTop }),
+ () => p.events.push({ type, ms: performance.now(), phase: p.phase }),
{ passive: true },
);
- const frame = () => {
+ const range = () => {
const ids = [...root.querySelectorAll<HTMLElement>('[data-turn-id]')].map(
(el) => el.dataset.turnId,
);
- p.frames.push({
+ if (p.ranges.at(-1)?.ids.join(',') === ids.join(',')) return;
+ p.ranges.push({
ms: performance.now(),
phase: p.phase,
- top: root.scrollTop,
- height: root.scrollHeight,
ids,
});
+ };
+ range();
+ const observer = new MutationObserver(range);
+ observer.observe(root, { childList: true, subtree: true });
+ const frame = () => {
+ p.frames.push({ ms: performance.now(), phase: p.phase });
if (p.running) requestAnimationFrame(frame);
+ else observer.disconnect();
};
requestAnimationFrame(frame);
});
- await cdp.send('Profiler.start');
for (let tick = 0; tick < 120; tick++) {
await cdp.send('Input.dispatchMouseEvent', input);
- await page.waitForTimeout(4);
+ await page.waitForTimeout(16);
}
const releasedAt = await page.evaluate(() => {
(window as any).__denseScroll.phase = 'released';
return performance.now();
});
await page.waitForTimeout(1200);
- const profile = await cdp.send('Profiler.stop');
const raw = await page.evaluate(() => {
(window as any).__denseScroll.running = false;
return (window as any).__denseScroll;
@@ -120,10 +122,7 @@ test('dense upward input with real Host history', async () => {
20,
);
const initial = raw.frames[0];
- const changes = raw.frames.filter(
- (frame: any, i: number) =>
- i > 0 && frame.ids.join(',') !== raw.frames[i - 1].ids.join(','),
- );
+ const changes = raw.ranges.slice(1);
expect(
changes.length,
'real Host history must publish at least one changed range',
@@ -137,13 +136,14 @@ test('dense upward input with real Host history', async () => {
wheels.slice(1).map((event: any, i: number) => event.ms - wheels[i].ms),
).median,
maxLongTaskMs: Math.max(0, ...raw.tasks.map((task: any) => task.duration)),
- maxMounted: Math.max(...raw.frames.map((frame: any) => frame.ids.length)),
+ longTaskMs: raw.tasks.reduce((sum: number, task: any) => sum + task.duration, 0),
+ maxFrameGapMs: Math.max(
+ ...raw.frames.slice(1).map((frame: any, i: number) => frame.ms - raw.frames[i].ms),
+ ),
+ maxMounted: Math.max(...raw.ranges.map((frame: any) => frame.ids.length)),
publicationsDuringInput: changes.filter((frame: any) => frame.ms < releasedAt).length,
publicationsAfterInput: changes.filter((frame: any) => frame.ms >= releasedAt).length,
firstPublicationAfterReleaseMs: firstReleased ? firstReleased.ms - releasedAt : -1,
- inputFramesAtTop: raw.frames.filter(
- (frame: any) => frame.phase === 'input' && frame.top <= 1,
- ).length,
};
samples.push(row);
console.log(JSON.stringify(row));
@@ -151,21 +151,19 @@ test('dense upward input with real Host history', async () => {
path.join(outputDir, `scroll-input-${trial}.json`),
JSON.stringify({ row, releasedAt, ...raw }, null, 2),
);
- await writeFile(
- path.join(outputDir, `scroll-input-${trial}.cpuprofile`),
- JSON.stringify(profile.profile),
- );
}
await report(
'frontend-scroll-input',
{
+ variant: process.env.MAKA_PERF_VARIANT,
+ sourceCommit: process.env.MAKA_PERF_SOURCE_COMMIT,
browser,
samples,
viewport: '1352x932',
conditions:
- 'Three renderer reloads in one real Desktop + Host. Native CDP input, 120 ticks at >=4ms driver spacing. Profile and trace enabled identically on both refs.',
+ 'Three renderer reloads in one real Desktop + Host. Native CDP input, 120 ticks at >=16ms driver spacing. No profiler or trace. Frame timestamps only; DOM ranges sampled on child-list mutation without layout reads.',
limits:
- 'Actual wheel intervals recorded; not exact touchpad replay. DOM publication is observable, pending store rows are not counted. A top frame alone does not prove starvation or data accumulation. CPU profile overhead included. -1 means no post-release range publication was observed.',
+ 'Actual wheel intervals recorded; not exact touchpad replay or end-to-end input latency. DOM range changes are observable, pending store rows are not counted. Mutation observer overhead remains. -1 means no post-release range publication was observed.',
},
Object.keys(samples[0])
.filter((key) => key !== 'trial')
diff --git a/scripts/perf/scroll-paired.mjs b/scripts/perf/scroll-paired.mjs
new file mode 100644
index 0000000000..7715d50570
--- /dev/null
+++ b/scripts/perf/scroll-paired.mjs
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { execFileSync } from 'node:child_process';
+import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
+import path from 'node:path';
+
+const refs = {
+ A: '839d14535a541ef0da29ea4d6626a2e3d0e32a8e',
+ B: '0039a230754a4bd832653f481194fb40516464db',
+};
+const files = ['packages/ui/src/chat-view.tsx', 'packages/ui/src/use-chat-scroll.ts'];
+const original = files.map((file) => readFileSync(file));
+const output = path.resolve(process.env.MAKA_PERF_OUTPUT ?? 'perf-results');
+const run = (command, args, options = {}) =>
+ execFileSync(command, args, { stdio: 'inherit', ...options });
+const order = ['A', 'B', 'B', 'A', 'A', 'B'];
+mkdirSync(output, { recursive: true });
+try {
+ for (const [index, variant] of order.entries()) {
+ for (const file of files)
+ writeFileSync(file, execFileSync('git', ['show', refs[variant] + ':' + file]));
+ run('npm', ['--workspace', '@maka/ui', 'run', 'build']);
+ run('npm', ['--workspace', '@maka/desktop', 'run', 'build:renderer']);
+ // The only source delta between the two refs is the measured-space experiment.
+ // Its unused helper remains present for A, with no import/call in A's bundle.
+ const env = {
+ ...process.env,
+ MAKA_PERF_PAIRED: '1',
+ MAKA_PERF_VARIANT: variant,
+ MAKA_PERF_SOURCE_COMMIT: refs[variant],
+ MAKA_PERF_OUTPUT: path.join(output, index + '-' + variant),
+ };
+ run(
+ 'npx',
+ [
+ 'playwright',
+ 'test',
+ '--config',
+ '../../scripts/perf/playwright.config.ts',
+ 'scroll-input.spec.ts',
+ ],
+ { cwd: 'apps/desktop', env },
+ );
+ }
+} finally {
+ files.forEach((file, index) => writeFileSync(file, original[index]));
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org