Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/player-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- shard: drift
scenarios: drift
runs: "3"
- shard: parity
scenarios: parity
runs: "3"
steps:
- uses: actions/checkout@v4

Expand All @@ -72,6 +75,18 @@ jobs:
with:
chrome-version: stable

# The parity scenario shells out to `ffmpeg -lavfi ssim` to score the
# live-playback frame against the sync-seek reference frame. ffmpeg is
# not on the default ubuntu-latest runner image, and a missing binary
# surfaces as ENOENT inside computeSsim() — informative, but cheaper
# to just install it here so the shard never trips on infra.
- name: Install ffmpeg (parity shard only)
if: matrix.shard == 'parity'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ffmpeg
ffmpeg -version | head -n 1

- name: Run player perf — ${{ matrix.shard }} (measure mode)
working-directory: packages/player
env:
Expand Down
1 change: 1 addition & 0 deletions packages/player/tests/perf/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"scrubLatencyP95InlineMs": 33,
"driftMaxMs": 500,
"driftP95Ms": 100,
"paritySsimMin": 0.93,
"allowedRegressionRatio": 0.1
}
14 changes: 12 additions & 2 deletions packages/player/tests/perf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { runFps } from "./scenarios/02-fps.ts";
import { runLoad } from "./scenarios/03-load.ts";
import { runScrub } from "./scenarios/04-scrub.ts";
import { runDrift } from "./scenarios/05-drift.ts";
import { runParity } from "./scenarios/06-parity.ts";
import { reportAndGate, type GateMode, type GateResult, type Metric } from "./perf-gate.ts";
import { launchBrowser } from "./runner.ts";
import { startServer } from "./server.ts";
Expand All @@ -41,7 +42,7 @@ const HERE = dirname(fileURLToPath(import.meta.url));
const RESULTS_DIR = resolve(HERE, "results");
const RESULTS_FILE = resolve(RESULTS_DIR, "metrics.json");

type ScenarioId = "load" | "fps" | "scrub" | "drift";
type ScenarioId = "load" | "fps" | "scrub" | "drift" | "parity";

/**
* Per-scenario default `runs` value when the caller didn't pass `--runs`.
Expand Down Expand Up @@ -76,6 +77,7 @@ const DEFAULT_RUNS: Record<ScenarioId, number> = {
fps: 3,
scrub: 3,
drift: 3,
parity: 3,
};

type ResultsFile = {
Expand Down Expand Up @@ -126,7 +128,7 @@ function parseArgs(argv: string[]): ParsedArgs {
// `mode` is consumed (measure logs regressions but never fails; enforce
// exits non-zero on regression).
mode: (process.env.PLAYER_PERF_MODE as GateMode) === "enforce" ? "enforce" : "measure",
scenarios: ["load", "fps", "scrub", "drift"],
scenarios: ["load", "fps", "scrub", "drift", "parity"],
runs: null,
fixture: null,
headful: false,
Expand Down Expand Up @@ -216,6 +218,14 @@ async function main(): Promise<void> {
fixture: args.fixture,
});
metrics.push(...m);
} else if (scenario === "parity") {
const m = await runParity({
browser,
origin: server.origin,
runs: args.runs ?? DEFAULT_RUNS.parity,
fixture: args.fixture,
});
metrics.push(...m);
} else {
console.warn(`[player-perf] unknown scenario: ${scenario}`);
}
Expand Down
1 change: 1 addition & 0 deletions packages/player/tests/perf/perf-gate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type PerfBaseline = {
scrubLatencyP95InlineMs: number;
driftMaxMs: number;
driftP95Ms: number;
paritySsimMin: number;
allowedRegressionRatio: number;
};

Expand Down
Loading
Loading