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
2 changes: 1 addition & 1 deletion .github/workflows/generate-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Set matrices from TypeScript config
id: set-matrix
run: |
FRAMEWORKS=$(node packages/stats-generator/src/print-frameworks.ts)
FRAMEWORKS=$(node packages/stats-generator/src/scripts/print-frameworks.ts)
echo "install=$(echo "$FRAMEWORKS" | jq -c '[.[] | select(.starter) | select(.measurements | (index("installDuration") != null or index("dependencyCounts") != null)) | {name, displayName, package: .starter.package, buildScript: .starter.buildScript, buildOutputDir: .starter.buildOutputDir, measurements}]')" >> $GITHUB_OUTPUT
echo "build=$(echo "$FRAMEWORKS" | jq -c '[.[] | select(.starter) | select(.measurements | (index("buildDuration") != null or index("coreJS") != null or index("browserBaseline") != null)) | {name, displayName, package: .starter.package, buildScript: .starter.buildScript, buildOutputDir: .starter.buildOutputDir, measurements}]')" >> $GITHUB_OUTPUT
echo "devServer=$(echo "$FRAMEWORKS" | jq -c '[.[] | select(.starter) | select(.measurements | index("devServerStartUpDuration") != null) | {name, displayName, package: .starter.package, devServerPort: .starter.devServerPort, measurements}]')" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/measure-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ jobs:
if: contains(matrix.framework.measurements, 'dependencyCounts')
env:
FRAMEWORK_NAME: ${{ matrix.framework.name }}
run: node packages/stats-generator/src/run-framework-dependency-scan.ts "$FRAMEWORK_NAME"
run: node packages/stats-generator/src/run-benchmarks-scripts/run-framework-dependency-scan.ts "$FRAMEWORK_NAME"

- name: Collect first-party dependency stats
if: contains(matrix.framework.measurements, 'dependencyCounts')
env:
FRAMEWORK_NAME: ${{ matrix.framework.name }}
run: node packages/stats-generator/src/run-first-party-dependency-scan.ts "$FRAMEWORK_NAME"
run: node packages/stats-generator/src/run-benchmarks-scripts/run-first-party-dependency-scan.ts "$FRAMEWORK_NAME"

- name: Scan installed dependencies for Node engine constraints
if: contains(matrix.framework.measurements, 'minimumNodeVersion')
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/sync-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'packages/starter-*/package.json'
- 'packages/app-*/package.json'
- 'packages/results/**'
- 'packages/stats-generator/src/frameworks.ts'
workflow_dispatch: # Allows manual triggering from GitHub Actions UI

jobs:
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ node_modules/
!.yarn/versions

# Build outputs
dist/
build/
/packages/app-*/dist/
/packages/app-*/build/
/packages/starter-*/dist/
/packages/starter-*/build/
/packages/docs/dist/
out/
.output/
dist-ssr/
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ flowchart LR
- [`frameworks-config.ts`](./packages/results/src/frameworks-config.ts) selects which measurements run for each starter and app.
- Put benchmark settings in [`measurements-config.ts`](./packages/results/src/measurements-config.ts). For example, `install: { runs: 5 }` runs five install measurements per job for each enabled starter. Entries like `dependencies: null` have no configurable repeat count here.

Edit the TypeScript config. [`print-frameworks.ts`](./packages/stats-generator/src/print-frameworks.ts)
Edit the TypeScript config. [`print-frameworks.ts`](./packages/stats-generator/src/scripts/print-frameworks.ts)
prints it as JSON so CI can build its benchmark matrices. Astro imports the same
registry for framework names and ordering, and for validating Code Comparison slugs.

Expand Down
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"entry": ["src/cwv/index.ts"]
},
"packages/stats-generator": {
"entry": ["src/serve/*.ts"]
"entry": ["src/app-servers/*.ts"]
}
}
}
2 changes: 1 addition & 1 deletion packages/docs/src/content/docs/methodology.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ pnpm dlx create-void starter-void --toolchain vite --framework react --starter s
response body is not read, because several dev servers stream the page and
body time would measure page size rather than startup.
- The port is the starter's default dev port, recorded as `devServerPort` in
`packages/stats-generator/src/frameworks.ts`. The starters are not modified, so whatever they
`packages/results/src/frameworks-config.ts`. The starters are not modified, so whatever they
ship is inside the measurement: Nuxt and TanStack Start enable devtools,
and Astro and React Router generate types at boot.
- The dev server runs with a minimal environment (`PATH`, `HOME`, `TMPDIR`,
Expand Down
52 changes: 26 additions & 26 deletions packages/stats-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
"private": true,
"type": "module",
"scripts": {
"run:ssr-request-throughput": "node src/run-ssr-request-throughput-benchmark.ts",
"run:ssr-load": "node src/run-ssr-load-benchmark.ts",
"run:ssr-load:containerized": "node src/run-containerized-ssr-load.ts",
"run:ssr-router-link-load": "SSR_LOAD_KIND=ssrLoadRouterLinks node src/run-ssr-load-benchmark.ts",
"run:ssr-router-link-load:containerized": "SSR_LOAD_KIND=ssrLoadRouterLinks node src/run-containerized-ssr-load.ts",
"verify:ssr-load": "node src/verify-ssr-load.ts",
"serve:ssr-load": "node src/run-ssr-load-server.ts",
"run:client-side-rendered": "node src/run-client-side-rendered-benchmark.ts",
"run:server-side-rendered": "node src/run-server-side-rendered-benchmark.ts",
"run:ssr-initial-load": "node src/scripts/run-ssr-initial-load-benchmark.ts",
"run:ssr-initial-load-images": "node src/scripts/run-ssr-initial-load-images-benchmark.ts",
"run:ssr-initial-load-framework-images": "node src/scripts/run-ssr-initial-load-framework-images-benchmark.ts",
"run:install": "node src/run-install-benchmark.ts",
"run:build": "node src/run-build-benchmark.ts",
"run:dev-server": "node src/run-dev-server-benchmark.ts",
"run:corejs": "node src/run-corejs-scan.ts",
"run:browser-baseline": "node src/run-browser-baseline-scan.ts",
"run:framework-dependencies": "node src/run-framework-dependency-scan.ts",
"run:first-party-dependencies": "node src/run-first-party-dependency-scan.ts",
"run:node-engines": "node src/run-node-engines-scan.ts",
"validate:ci-stats": "node src/save-ci-stats.ts --validate-only",
"save:ci-stats": "node src/save-ci-stats.ts",
"validate": "node src/save-ci-stats.ts --validate-only",
"validate:first-party-dependencies": "node src/validate-first-party-dependencies.ts",
"sync:versions": "node src/sync-versions.ts",
"run:ssr-request-throughput": "node src/run-benchmarks-scripts/run-ssr-request-throughput-benchmark.ts",
"run:ssr-load": "node src/run-benchmarks-scripts/run-ssr-load-benchmark.ts",
"run:ssr-load:containerized": "node src/run-benchmarks-scripts/run-containerized-ssr-load.ts",
"run:ssr-router-link-load": "SSR_LOAD_KIND=ssrLoadRouterLinks node src/run-benchmarks-scripts/run-ssr-load-benchmark.ts",
"run:ssr-router-link-load:containerized": "SSR_LOAD_KIND=ssrLoadRouterLinks node src/run-benchmarks-scripts/run-containerized-ssr-load.ts",
"verify:ssr-load": "node src/benchmarks/ssr-load/verify-ssr-load.ts",
"serve:ssr-load": "node src/run-benchmarks-scripts/run-ssr-load-server.ts",
"run:client-side-rendered": "node src/run-benchmarks-scripts/run-client-side-rendered-benchmark.ts",
"run:server-side-rendered": "node src/run-benchmarks-scripts/run-server-side-rendered-benchmark.ts",
"run:ssr-initial-load": "node src/run-benchmarks-scripts/run-ssr-initial-load-benchmark.ts",
"run:ssr-initial-load-images": "node src/run-benchmarks-scripts/run-ssr-initial-load-images-benchmark.ts",
"run:ssr-initial-load-framework-images": "node src/run-benchmarks-scripts/run-ssr-initial-load-framework-images-benchmark.ts",
"run:install": "node src/run-benchmarks-scripts/run-install-benchmark.ts",
"run:build": "node src/run-benchmarks-scripts/run-build-benchmark.ts",
"run:dev-server": "node src/run-benchmarks-scripts/run-dev-server-benchmark.ts",
"run:corejs": "node src/run-benchmarks-scripts/run-corejs-scan.ts",
"run:browser-baseline": "node src/run-benchmarks-scripts/run-browser-baseline-scan.ts",
"run:framework-dependencies": "node src/run-benchmarks-scripts/run-framework-dependency-scan.ts",
"run:first-party-dependencies": "node src/run-benchmarks-scripts/run-first-party-dependency-scan.ts",
"run:node-engines": "node src/run-benchmarks-scripts/run-node-engines-scan.ts",
"validate:ci-stats": "node src/scripts/save-ci-stats.ts --validate-only",
"save:ci-stats": "node src/scripts/save-ci-stats.ts",
"validate": "node src/scripts/save-ci-stats.ts --validate-only",
"validate:first-party-dependencies": "node src/scripts/validate-first-party-dependencies.ts",
"sync:versions": "node src/scripts/sync-versions.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"type-check": "tsc --noEmit",
"test": "node --test src/*.test.ts"
"test": "node --test \"src/**/*.test.ts\""
},
"dependencies": {
"autocannon": "^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createServer } from 'node:http'
import { testData } from '../../../testdata/src/ssr.ts'
import { renderBaselineHtml } from '../baseline-html.ts'
import { renderBaselineHtml } from '../benchmarks/shared/baseline-html.ts'
import { getHost, getPort, registerShutdown } from './common.ts'

const HOST = getHost()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { once } from 'node:events'
import { join } from 'node:path'
import { setTimeout as sleep } from 'node:timers/promises'
import { fileURLToPath } from 'node:url'
import { packagesDir } from './constants.ts'
import { packagesDir } from '../utils/paths.ts'

export async function waitForBenchmarkServer(
url: string,
Expand Down Expand Up @@ -33,7 +33,7 @@ export async function startBenchmarkServer(
): Promise<() => Promise<void>> {
const { host, port, readinessPath, timeoutMs = 30_000 } = options
const scriptPath = fileURLToPath(
new URL(`./serve/${config.serveScript}`, import.meta.url),
new URL(`./${config.serveScript}`, import.meta.url),
)
const proc = spawn(
process.execPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import {
detectFeatures,
} from 'baseline-detector'
import { glob } from 'tinyglobby'
import { packagesDir } from './constants.ts'
import {
benchmarkOutputPath,
getBenchmarkContext,
requireMeasurements,
writeJsonFile,
} from './utils.ts'
import { packagesDir } from '../../utils/paths.ts'
import { benchmarkOutputPath } from '../../utils/paths.ts'
import { writeJsonFile } from '../../utils/files.ts'

import type { TestConfig } from '../../types.ts'

type BaselineStatus = ReturnType<
typeof BrowserBaselineBenchmark.parse
Expand Down Expand Up @@ -85,12 +83,10 @@ async function stageBrowserBuildFiles(buildOutputPath: string) {
}
}

async function main() {
const { packageName, projectConfig, framework } = await getBenchmarkContext({
project: 'starter',
})
requireMeasurements(framework, ['browserBaseline'])

export async function runBrowserBaselineScan(
packageName: string,
projectConfig: TestConfig,
) {
const buildOutputPath = join(
packagesDir,
packageName,
Expand Down Expand Up @@ -160,8 +156,3 @@ async function main() {
await rm(scanDir, { recursive: true, force: true })
}
}

main().catch((error) => {
console.error('Browser baseline scan failed:', error)
process.exit(1)
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { summarizeMetric } from './sample-statistics.ts'
import { summarizeMetric } from '../shared/sample-statistics.ts'
import { BuildBenchmark } from '@framework-performance/results/benchmark-schemas'

export function createBuildStats(cold: number[], warm: number[]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { measurementsConfig } from './measurements.ts'
import { measurementsConfig } from '@framework-performance/results/measurements-config'
import { execFileSync } from 'node:child_process'
import { cpSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { isAbsolute, join, relative, resolve, sep } from 'node:path'
import { copyTrackedProject, installDependencies } from './benchmark-utils.ts'
import { packagesDir } from './constants.ts'
import {
benchmarkOutputPath,
writeJsonFile,
getBenchmarkContext,
requireMeasurements,
} from './utils.ts'
import { copyTrackedProject, installDependencies } from '../../utils/project.ts'
import { packagesDir } from '../../utils/paths.ts'
import { benchmarkOutputPath } from '../../utils/paths.ts'
import { writeJsonFile } from '../../utils/files.ts'
import { createBuildStats } from './build-statistics.ts'
import { summarizeSamples } from './sample-statistics.ts'
import { summarizeSamples } from '../shared/sample-statistics.ts'

import type { FrameworkConfig, TestConfig } from '../../types.ts'

function measureBuildTime(cwd: string, buildScript: string): number {
const start = performance.now()
Expand Down Expand Up @@ -46,12 +44,11 @@ function getBuildOutputPath(
return buildOutputPath
}

async function main() {
const { packageName, framework, projectConfig } = await getBenchmarkContext({
project: 'starter',
})
requireMeasurements(framework, ['buildDuration', 'coreJS', 'browserBaseline'])

export async function runBuildBenchmark(
packageName: string,
framework: FrameworkConfig,
projectConfig: TestConfig,
) {
const runFrequency = measurementsConfig.build.runs

console.info(
Expand Down Expand Up @@ -142,8 +139,3 @@ async function main() {
rmSync(tempDir, { recursive: true, force: true })
}
}

main().catch((error) => {
console.error('Build benchmark failed:', error)
process.exit(1)
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test } from 'node:test'
import assert from 'node:assert/strict'
import { assembleClientRendering } from './client-rendering.ts'
import { CSRLighthouseBenchmark } from '@framework-performance/results/benchmark-schemas'
import { measuredCSRLighthouse } from './rendered-sample-metrics.ts'
import { measuredCSRLighthouse } from '../shared/rendered-sample-metrics.ts'

test('assembles client rendering from exact raw browser measurements', () => {
const iterations = [1, 3].map((value) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
renderedSampleMetrics,
measuredCSRLighthouse,
} from './rendered-sample-metrics.ts'
import { summarizeMetric } from './sample-statistics.ts'
import type { RenderedTestSample } from './types.ts'
} from '../shared/rendered-sample-metrics.ts'
import { summarizeMetric } from '../shared/sample-statistics.ts'
import type { RenderedTestSample } from '../../types.ts'

export function assembleClientRendering(iterations: RenderedTestSample[]) {
return measuredCSRLighthouse.parse({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { measurementsConfig } from '../measurements.ts'
import type { FrameworkConfig, TestConfig } from '../types.ts'
import { startBenchmarkServer } from '../benchmark-server.ts'
import { getHost } from '../serve/common.ts'
import { measurementsConfig } from '@framework-performance/results/measurements-config'
import type { FrameworkConfig, TestConfig } from '../../types.ts'
import { startBenchmarkServer } from '../../app-servers/benchmark-server.ts'
import { getHost } from '../../app-servers/common.ts'
import { runBenchmark } from './run-benchmark.ts'
import type { ClientSideRenderedBenchmarkResult } from './types.ts'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { findChromium } from '../find-chromium.ts'
import { measurementsConfig } from '../measurements.ts'
import { assembleClientRendering } from '../client-rendering.ts'
import { findChromium } from '../../utils/find-chromium.ts'
import { measurementsConfig } from '@framework-performance/results/measurements-config'
import { assembleClientRendering } from './client-rendering.ts'
import puppeteer from 'puppeteer-core'
import { startFlow } from 'lighthouse'
import { warmUpServer } from '../server-warmup.ts'
import { warmUpServer } from '../../app-servers/server-warmup.ts'
import {
getInteractionTimingFromLighthouse,
getNavigationInteractionTimingFromLighthouse,
prepareInteractionTraceForLighthouse,
} from '../interaction-timing.ts'
import { getInteractionWorkFromTrace } from '../interaction-work.ts'
} from '../shared/interaction-timing.ts'
import { getInteractionWorkFromTrace } from '../shared/interaction-work.ts'
import type {
ClientSideRenderedBenchmarkResult,
ClientSideRenderedRunResult,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { z } from 'zod'
import type { CSRLighthouseBenchmark } from '@framework-performance/results/benchmark-schemas'
import type { InteractionTiming } from '../types.ts'
import type { InteractionWork } from '../interaction-work.ts'
import type { InteractionTiming } from '../../types.ts'
import type { InteractionWork } from '../shared/interaction-work.ts'

export interface ClientSideRenderedRunResult {
firstPaint: number | null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { join, relative } from 'node:path'
import { glob } from 'tinyglobby'
import coreJsCompat from 'core-js-compat/compat.js'
import getModulesListForTargetVersion from 'core-js-compat/get-modules-list-for-target-version.js'
import { packagesDir } from './constants.ts'
import {
benchmarkOutputPath,
getBenchmarkContext,
requireMeasurements,
writeJsonFile,
} from './utils.ts'
import { packagesDir } from '../../utils/paths.ts'
import { benchmarkOutputPath } from '../../utils/paths.ts'
import { writeJsonFile } from '../../utils/files.ts'

import type { FrameworkConfig, TestConfig } from '../../types.ts'

const BROWSER_TARGETS =
'last 2 Chrome major versions, last 2 Firefox major versions, last 2 Safari major versions, last 2 Edge major versions'
Expand Down Expand Up @@ -41,12 +39,11 @@ function extractVersion(source: string): string {
return match ? match[1] : 'unknown'
}

async function main() {
const { packageName, framework, projectConfig } = await getBenchmarkContext({
project: 'starter',
})
requireMeasurements(framework, ['coreJS'])

export async function runCoreJsScan(
packageName: string,
framework: FrameworkConfig,
projectConfig: TestConfig,
) {
console.info(
`Scanning build output for vendored core-js in ${framework.displayName} (${packageName})...\n`,
)
Expand Down Expand Up @@ -131,8 +128,3 @@ async function main() {

console.info(`\n✓ Saved core-js stats to ${outputPath}`)
}

main().catch((error) => {
console.error('Core-js scan failed:', error)
process.exit(1)
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { summarizeMetric } from './sample-statistics.ts'
import { summarizeMetric } from '../shared/sample-statistics.ts'
import { DevServerStartupBenchmark } from '@framework-performance/results/benchmark-schemas'

export function createDevServerStats(samples: number[]) {
Expand Down
Loading
Loading