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
68 }68 }
69 const sorted = values.toSorted((left, right) => left - right);69 const sorted = values.toSorted((left, right) => left - right);
70 const clampedTarget = Math.min(Math.max(target, 0), 1);70 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 );
72 return sorted[index] ?? null;75 return sorted[index] ?? null;
73}76}
74 77
test/perf/support/browserMetrics.ts+5−3
@@ -30,15 +30,16 @@ export function installBrowserPerfCollector( · 29 unmodified lines
30 const rafGapsMs: number[] = [];30 const rafGapsMs: number[] = [];
31 const mountedRowSamples: Array<BrowserPerfMetrics["mountedRowSamples"][number]> = [];31 const mountedRowSamples: Array<BrowserPerfMetrics["mountedRowSamples"][number]> = [];
32 let previousAnimationFrameTs = 0;32 let previousAnimationFrameTs = 0;
33 let rafHandle = 0;
33 34
34 const animationFrameLoop = (timestampMs: number) => {35 const animationFrameLoop = (timestampMs: number) => {
35 if (previousAnimationFrameTs > 0) {36 if (previousAnimationFrameTs > 0) {
36 rafGapsMs.push(timestampMs - previousAnimationFrameTs);37 rafGapsMs.push(timestampMs - previousAnimationFrameTs);
37 }38 }
38 previousAnimationFrameTs = timestampMs;39 previousAnimationFrameTs = timestampMs;
39 window.requestAnimationFrame(animationFrameLoop);40 rafHandle = window.requestAnimationFrame(animationFrameLoop);
40 };41 };
41 window.requestAnimationFrame(animationFrameLoop);42 rafHandle = window.requestAnimationFrame(animationFrameLoop);
42 43
43 if (typeof PerformanceObserver !== "undefined") {44 if (typeof PerformanceObserver !== "undefined") {
44 try {45 try {
@@ -103,7 +104,8 @@ export function installBrowserPerfCollector( · 58 unmodified lines
103 rafGapsMs.length = 0;104 rafGapsMs.length = 0;
104 mountedRowSamples.length = 0;105 mountedRowSamples.length = 0;
105 previousAnimationFrameTs = 0;106 previousAnimationFrameTs = 0;
106 window.requestAnimationFrame(animationFrameLoop);107 window.cancelAnimationFrame(rafHandle);
108 rafHandle = window.requestAnimationFrame(animationFrameLoop);
107 },109 },
108 };110 };
109}111}

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