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
5 changes: 3 additions & 2 deletions .github/workflows/generate-stats.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Generate Stats

env:
RUNNER_LABEL: 'Depot depot-ubuntu-24.04 GitHub Actions runner (2 CPUs, 8 GB RAM, 100 GB disk, 2 GB disk accelerator)'

on:
push:
branches: [main]
Expand Down Expand Up @@ -93,8 +96,6 @@ jobs:

- name: Save CI stats
run: pnpm --filter @framework-tracker/stats-generator save:ci-stats $GITHUB_WORKSPACE/artifacts
env:
RUNNER_LABEL: ubuntu-latest

- name: Collect stats for docs
run: pnpm collect:stats
Expand Down
27 changes: 9 additions & 18 deletions .github/workflows/measure-framework.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Measure Framework

env:
RUNNER_LABEL: 'Depot depot-ubuntu-24.04 GitHub Actions runner (2 CPUs, 8 GB RAM, 100 GB disk, 2 GB disk accelerator)'

on:
workflow_call:
inputs:
Expand Down Expand Up @@ -169,8 +172,6 @@ jobs:

- name: Run SSR request throughput benchmark
run: pnpm --filter @framework-tracker/stats-generator run:ssr-request-throughput ${{ matrix.framework.package }}
env:
RUNNER_LABEL: ubuntu-latest

- name: Upload SSR request throughput stats
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down Expand Up @@ -249,8 +250,6 @@ jobs:

- name: Run SSR load benchmark
run: pnpm --filter @framework-tracker/stats-generator run:ssr-load ${{ matrix.framework.package }}
env:
RUNNER_LABEL: ubuntu-latest

- name: Upload SSR load stats
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand All @@ -263,9 +262,6 @@ jobs:
measure-client-side-rendered:
if: inputs.client-side-rendered-matrix != '[]'
runs-on: depot-ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.49.0-noble
options: --ipc=host
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -294,12 +290,11 @@ jobs:
working-directory: ./packages/${{ matrix.framework.package }}
run: pnpm build

- name: Verify runner Chrome
run: google-chrome --version

- name: Run client-side rendered benchmark
run: pnpm --filter @framework-tracker/stats-generator run:client-side-rendered ${{ matrix.framework.package }}
env:
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
RUNNER_LABEL: ubuntu-latest

- name: Upload client-side rendered stats
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand All @@ -312,9 +307,6 @@ jobs:
measure-server-side-rendered:
if: inputs.server-side-rendered-matrix != '[]'
runs-on: depot-ubuntu-24.04
container:
image: mcr.microsoft.com/playwright:v1.49.0-noble
options: --ipc=host
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -343,12 +335,11 @@ jobs:
working-directory: ./packages/${{ matrix.framework.package }}
run: pnpm build

- name: Verify runner Chrome
run: google-chrome --version

- name: Run server-side rendered benchmark
run: pnpm --filter @framework-tracker/stats-generator run:server-side-rendered ${{ matrix.framework.package }}
env:
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
RUNNER_LABEL: ubuntu-latest

- name: Upload server-side rendered stats
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/preview-stats.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Preview Stats

env:
RUNNER_LABEL: 'Depot depot-ubuntu-24.04 GitHub Actions runner (2 CPUs, 8 GB RAM, 100 GB disk, 2 GB disk accelerator)'

on:
workflow_dispatch:

Expand Down Expand Up @@ -113,8 +116,6 @@ jobs:

- name: Save CI stats
run: pnpm --filter @framework-tracker/stats-generator save:ci-stats $GITHUB_WORKSPACE/artifacts
env:
RUNNER_LABEL: ubuntu-latest

- name: Collect stats for docs
run: pnpm collect:stats
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const devtimeSchema = z.object({
.optional(),
timingMeasuredAt: z.string(),
runner: z.string(),
browserVersion: z.string().optional(),
frameworkVersion: z.string().optional(),
})

Expand Down Expand Up @@ -118,6 +119,7 @@ const runtimeSchema = z.object({
.optional(),
timingMeasuredAt: z.string().optional(),
runner: z.string().optional(),
browserVersion: z.string().optional(),
frameworkVersion: z.string().optional(),
})

Expand Down
8 changes: 8 additions & 0 deletions packages/docs/src/content/docs/methodology.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ starting a framework and the runtime cost of serving and hydrating a comparable
app. Timing results are run multiple times and averaged, and generated JSON is
published into the docs package.

Benchmarks run on Depot GitHub Actions runners using
[`depot-ubuntu-24.04`](https://depot.dev/docs/github-actions/runner-types),
which Depot documents as an Intel runner with 2 CPUs, 8 GB RAM, 100 GB disk,
and a 2 GB disk accelerator. Browser rendering benchmarks run directly on the
Depot runner host and use the host Chrome installation rather than a job-level
browser container. The generated runtime stats record the Chrome version used
for browser rendering benchmarks.

## Dev Time

Dev Time measurements use the repository's `starter-*` packages. These projects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync, readdirSync } from 'node:fs'
import { execFileSync } from 'node:child_process'
import puppeteer from 'puppeteer-core'
import { startFlow } from 'lighthouse'
import type {
Expand Down Expand Up @@ -36,6 +37,16 @@ function findChromium(): string {
)
}

function getBrowserVersion(chromiumPath: string): string | undefined {
try {
return execFileSync(chromiumPath, ['--version'], {
encoding: 'utf-8',
}).trim()
} catch {
return undefined
}
}

async function runOnce(
url: string,
chromiumPath: string,
Expand Down Expand Up @@ -107,6 +118,7 @@ export async function runBenchmark(
runs: number,
): Promise<ClientSideRenderedBenchmarkResult> {
const chromiumPath = findChromium()
const browserVersion = getBrowserVersion(chromiumPath)
const results: ClientSideRenderedRunResult[] = []

for (let i = 0; i < runs; i++) {
Expand All @@ -124,6 +136,7 @@ export async function runBenchmark(
name: packageName,
displayName,
package: packageName,
browserVersion,
clientSideRenderedTests: {
firstPaintMs: avg(fp),
fcpMs: avg(fcp),
Expand Down
2 changes: 2 additions & 0 deletions packages/stats-generator/src/clientSideRendered/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ClientSideRenderedBenchmarkResult {
name: string
displayName: string
package: string
browserVersion?: string
clientSideRenderedTests: {
firstPaintMs: number
fcpMs: number
Expand All @@ -19,6 +20,7 @@ export interface ClientSideRenderedBenchmarkResult {
export interface ClientSideRenderedStats {
timingMeasuredAt: string
runner: string
browserVersion?: string
frameworkVersion?: string
clientSideRenderedTests: {
firstPaintMs: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async function main() {
...existingStats,
timingMeasuredAt: timestamp,
runner,
browserVersion: result.browserVersion,
frameworkVersion: frameworkVersion ?? existingStats?.frameworkVersion,
clientSideRenderedTests: result.clientSideRenderedTests,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async function main() {
...existingStats,
timingMeasuredAt: timestamp,
runner,
browserVersion: result.browserVersion,
frameworkVersion: frameworkVersion ?? existingStats?.frameworkVersion,
serverSideRenderedTests: result.serverSideRenderedTests,
}
Expand Down
4 changes: 4 additions & 0 deletions packages/stats-generator/src/save-ci-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ async function main() {
console.info(` ✓ Found client-side rendered stats artifact`)
stats = {
...stats,
browserVersion:
clientSideRenderedStats.browserVersion ?? stats.browserVersion,
clientSideRenderedTests:
clientSideRenderedStats.clientSideRenderedTests,
}
Expand All @@ -300,6 +302,8 @@ async function main() {
console.info(` ✓ Found server-side rendered stats artifact`)
stats = {
...stats,
browserVersion:
serverSideRenderedStats.browserVersion ?? stats.browserVersion,
frameworkVersion: serverSideRenderedStats.frameworkVersion,
serverSideRenderedTests:
serverSideRenderedStats.serverSideRenderedTests,
Expand Down
2 changes: 2 additions & 0 deletions packages/stats-generator/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const SSRRequestThroughputStatsSchema = z.object({
frameworkVersion: z.string().optional(),
timingMeasuredAt: z.string().optional(),
runner: z.string().optional(),
browserVersion: z.string().optional(),
})

export const SSRLoadStatsSchema = z.object({
Expand Down Expand Up @@ -79,6 +80,7 @@ export const SSRLoadStatsSchema = z.object({
frameworkVersion: z.string().optional(),
timingMeasuredAt: z.string().optional(),
runner: z.string().optional(),
browserVersion: z.string().optional(),
})

export type InstallStats = z.infer<typeof InstallStatsSchema>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync, readdirSync } from 'node:fs'
import { execFileSync } from 'node:child_process'
import puppeteer from 'puppeteer-core'
import { startFlow } from 'lighthouse'
import type {
Expand Down Expand Up @@ -36,6 +37,16 @@ function findChromium(): string {
)
}

function getBrowserVersion(chromiumPath: string): string | undefined {
try {
return execFileSync(chromiumPath, ['--version'], {
encoding: 'utf-8',
}).trim()
} catch {
return undefined
}
}

async function runOnce(
url: string,
chromiumPath: string,
Expand Down Expand Up @@ -109,6 +120,7 @@ export async function runBenchmark(
runs: number,
): Promise<ServerSideRenderedBenchmarkResult> {
const chromiumPath = findChromium()
const browserVersion = getBrowserVersion(chromiumPath)
const results: ServerSideRenderedRunResult[] = []

for (let i = 0; i < runs; i++) {
Expand All @@ -126,6 +138,7 @@ export async function runBenchmark(
name: packageName,
displayName,
package: packageName,
browserVersion,
serverSideRenderedTests: {
firstPaintMs: avg(fp),
fcpMs: avg(fcp),
Expand Down
2 changes: 2 additions & 0 deletions packages/stats-generator/src/serverSideRendered/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ServerSideRenderedBenchmarkResult {
name: string
displayName: string
package: string
browserVersion?: string
serverSideRenderedTests: {
firstPaintMs: number
fcpMs: number
Expand All @@ -19,6 +20,7 @@ export interface ServerSideRenderedBenchmarkResult {
export interface ServerSideRenderedStats {
timingMeasuredAt: string
runner: string
browserVersion?: string
frameworkVersion?: string
serverSideRenderedTests: {
firstPaintMs: number
Expand Down
1 change: 1 addition & 0 deletions packages/stats-generator/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface FrameworkConfig {
export interface CIStats {
timingMeasuredAt?: string
runner?: string
browserVersion?: string
frameworkVersion?: string
// Install stats
installTime?: TimeStat
Expand Down
Loading