mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
e46e2dbb05
* feat(web): add performance benchmark dashboard * fix(web): clean up benchmark dashboard exports * fix(web): support benchmark runs without baselines * fix(perf): support targeted main baseline runs * fix(web): revalidate benchmark commit baselines * feat(perf): improve vinext trace profiles * fix(web): neutralize insignificant benchmark diffs * fix(perf): replace existing benchmark runs * fix(perf): expose vinext trace frames * feat(perf): retain complete vinext trace detail * feat(perf): filter flame graph categories * fix(web): compact flame graph rows * fix(perf): replace runs by commit identity * fix(benchmarks): preserve complete performance traces * fix(benchmarks): use commit time for performance runs * fix(benchmarks): store performance profiles in R2 * fix(benchmarks): stream performance profiles to R2 * fix(benchmarks): decode raw performance profiles * fix(benchmarks): show inclusive filtered profile time * fix(benchmarks): resize filtered flame graphs * fix(benchmarks): render narrow flame frames * perf(benchmarks): bound flame graph detail * ci(perf): split benchmark publication privileges * fix(perf): harden benchmark publication * fix(perf): initialize runner paths in job * fix(perf): install through vite plus * fix(perf): disable pnpm hooks during install * fix(perf): select trusted harness ref * fix(perf): resolve vite plus for isolated user * fix(perf): grant isolated tool access * fix(perf): share benchmark cache cleanup * fix(perf): harden trace publication * chore(perf): format migration snapshots * feat(web): restore benchmarks navigation
20 lines
641 B
TypeScript
20 lines
641 B
TypeScript
/** Shared formatting and comparison helpers for the benchmarks dashboard. */
|
|
|
|
export function formatMs(ms: number | null): string {
|
|
if (ms === null) return "-";
|
|
if (ms < 1000) return `${Math.round(ms)} ms`;
|
|
return `${(ms / 1000).toFixed(2)} s`;
|
|
}
|
|
|
|
export function formatBytes(b: number | null): string {
|
|
if (b === null) return "-";
|
|
if (b < 1024) return `${b} B`;
|
|
if (b < 1024 * 1024) return `${(b / 1024).toFixed(1)} KB`;
|
|
return `${(b / (1024 * 1024)).toFixed(2)} MB`;
|
|
}
|
|
|
|
export const RUNNER_COLORS: Record<string, string> = {
|
|
nextjs: "var(--color-chart-nextjs, #f97316)",
|
|
vinext: "var(--color-chart-vinext, #3b82f6)",
|
|
};
|