History

Clean up perf run dirs and cover collector reset

- Persist and remove the seeded run parent directory after perf runs - Add regression coverage for seed cleanup, percentile clamping, and RAF reset

Julius Marminge committed 7 months ago

Commit 062c8091 parent b8fba1810 files · +260 −436Browse files

Showing the changes to test (2 of 10 files). Show all

Unified · Split

2 files
  1. test/perf/support/artifact.ts +4 −1
  2. test/perf/support/browserMetrics.ts +5 −3
test/perf/support/artifact.ts+4−1
@@ -68,7 +68,10 @@ export function percentile(values: ReadonlyArray<number>, target: number): numbe · 67 unmodified lines
6868 }
6969 const sorted = values.toSorted((left, right) => left - right);
7070 const clampedTarget = Math.min(Math.max(target, 0), 1);
71− const index = Math.min(sorted.length - 1, Math.ceil(sorted.length * clampedTarget) - 1);
71+ const index = Math.min(
72+ sorted.length - 1,
73+ Math.max(0, Math.ceil(sorted.length * clampedTarget) - 1),
74+ );
7275 return sorted[index] ?? null;
7376 }
7477
test/perf/support/browserMetrics.ts+5−3
@@ -30,15 +30,16 @@ export function installBrowserPerfCollector( · 29 unmodified lines
3030 const rafGapsMs: number[] = [];
3131 const mountedRowSamples: Array<BrowserPerfMetrics["mountedRowSamples"][number]> = [];
3232 let previousAnimationFrameTs = 0;
33+ let rafHandle = 0;
3334
3435 const animationFrameLoop = (timestampMs: number) => {
3536 if (previousAnimationFrameTs > 0) {
3637 rafGapsMs.push(timestampMs - previousAnimationFrameTs);
3738 }
3839 previousAnimationFrameTs = timestampMs;
39− window.requestAnimationFrame(animationFrameLoop);
40+ rafHandle = window.requestAnimationFrame(animationFrameLoop);
4041 };
41− window.requestAnimationFrame(animationFrameLoop);
42+ rafHandle = window.requestAnimationFrame(animationFrameLoop);
4243
4344 if (typeof PerformanceObserver !== "undefined") {
4445 try {
@@ -103,7 +104,8 @@ export function installBrowserPerfCollector( · 58 unmodified lines
103104 rafGapsMs.length = 0;
104105 mountedRowSamples.length = 0;
105106 previousAnimationFrameTs = 0;
106− window.requestAnimationFrame(animationFrameLoop);
107+ window.cancelAnimationFrame(rafHandle);
108+ rafHandle = window.requestAnimationFrame(animationFrameLoop);
107109 },
108110 };
109111 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t