perf: load the Git Log scenario's pages with git's latency and scroll across several

This commit is contained in:
l0ng-ai committed 2026-11-07 10:39:42 +08:00
1 parent cb614eff95
commit 071ece852b
3 files changed
+16 -10

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@
"consoleOutput.keyMissedFramePct": 10,
"consoleOutput.tbtMs": 50,
"gitLog.showMs": 150,
"gitLog.showMs": 300,
"gitLog.droppedFramesPct": 2,
"gitLog.tbtMs": 50,
"gitLog.arrowKeyP95Ms": 20,
+9 -5
View File
@@ -269,15 +269,18 @@ const scroll: Scenario = {
/**
* Git Log with 20,000 commits on branching lanes, loaded page by page as the
* backend does: showing it, walking the selection with the arrow keys (the
* details pane follows) and wheel-scrolling through it.
* backend does (150 ms a page, like `git log`): showing it, walking the
* selection with the arrow keys (the details pane follows) and wheel-scrolling
* through several pages.
*/
const gitLog: Scenario = {
id: "gitLog",
title: "Show, navigate and scroll a 20k-commit Git Log",
async run(h) {
await h.page.evaluate(() =>
(window as never as { __openideaPerf: { fakeGitLog(n: number): void } }).__openideaPerf.fakeGitLog(20_000),
(
window as never as { __openideaPerf: { fakeGitLog(n: number, latencyMs?: number): void } }
).__openideaPerf.fakeGitLog(20_000, 150),
);
const showMs = await h.measure(
() =>
@@ -297,8 +300,9 @@ const gitLog: Scenario = {
await h.page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
const t0 = await h.now();
await h.inPage((p) => p.startFrames());
for (let i = 0; i < 120; i++) {
await h.page.mouse.wheel(0, i < 80 ? 400 : -400);
// Far enough to load several more pages on the way.
for (let i = 0; i < 160; i++) {
await h.page.mouse.wheel(0, i < 120 ? 600 : -600);
await h.page.waitForTimeout(16);
}
await h.page.waitForTimeout(200);
+6 -4
View File
@@ -32,9 +32,10 @@ export interface PerfProbe {
fakeCompletion(items: number): void;
/**
* Answers the Git Log with `commits` generated commits (a main line with
* feature branches merging into it), paged like the backend. `0` removes it.
* feature branches merging into it), paged like the backend, each page after
* `latencyMs` (a `git log` call). `0` commits removes it.
*/
fakeGitLog(commits: number): void;
fakeGitLog(commits: number, latencyMs?: number): void;
}
const KINDS: CompletionKind[] = [
@@ -159,7 +160,7 @@ export function installPerfProbe(): () => void {
: null,
);
},
fakeGitLog(count) {
fakeGitLog(count, latencyMs = 0) {
const commits = Array.from({ length: count }, (_, i) => commit(i, count));
setRoute(
"gitLog",
@@ -169,7 +170,8 @@ export function installPerfProbe(): () => void {
const { skip, limit, range } = (args as { query: LogQuery }).query;
// Outgoing commits (`@{u}..HEAD`) and the like: none.
if (range) return Promise.resolve([]);
return Promise.resolve(commits.slice(skip, limit ? skip + limit : undefined));
const page = commits.slice(skip, limit ? skip + limit : undefined);
return new Promise((resolve) => setTimeout(() => resolve(page), latencyMs));
}
: null,
);