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
25 changes: 25 additions & 0 deletions packages/docs/src/components/InReview.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
import type { MeasurementName } from '@framework-performance/results/measurements-config'
import { isMeasurementShown } from '../lib/measurement-status'

/**
* For a new benchmark, leave the section title visible so its table of contents
* link still works. Wrap everything under the title in <InReview test="…">,
* using the measurement key or an array of keys for a shared section.
* Keep the wrapper for a while after marking the benchmark live so you can
* switch it back to in-review if you find an issue with the results.
*/
interface Props {
test: MeasurementName | MeasurementName[]
}

const tests = [Astro.props.test].flat()
---

{
tests.every(isMeasurementShown) ? (
<slot />
) : (
<p>This benchmark is in review. Results are coming soon.</p>
)
}
12 changes: 12 additions & 0 deletions packages/docs/src/lib/measurement-status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
measurementsConfig,
type MeasurementName,
} from '@framework-performance/results/measurements-config'

// Cloudflare Workers Builds deploys the production site from main
const isProductionBuild = process.env.WORKERS_CI_BRANCH === 'main'

/** In-review tests show in local builds and deploy previews, not production */
export function isMeasurementShown(name: MeasurementName) {
return !isProductionBuild || measurementsConfig[name].status === 'live'
}
27 changes: 19 additions & 8 deletions packages/results/src/measurements-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ const ssrLoad = {

const interactionScenarioLabel = 'first-row-detail-navigation'

/** `in-review` tests only show in local builds and deploy previews, not the production site. */
export type MeasurementStatus = 'live' | 'in-review'

/** Shared defaults for every framework. Scans run once; benchmarks repeat. */
export const measurementsConfig = {
install: { runs: 5 },
build: { runs: 5 },
devServer: { runs: 5 },
dependencies: null,
browserBaseline: null,
nodeEngines: null,
install: { status: 'live', runs: 5 },
build: { status: 'live', runs: 5 },
devServer: { status: 'live', runs: 5 },
dependencies: { status: 'live' },
browserBaseline: { status: 'live' },
nodeEngines: { status: 'live' },
ssrRequestThroughput: {
status: 'live',
runs: 5,
durationMs: 10_000,
warmupDurationMs: 250,
Expand All @@ -27,23 +31,30 @@ export const measurementsConfig = {
path: '/ssr-throughput',
},
ssrLoad: {
status: 'live',
...ssrLoad,
plainLinksPath: '/server-side-rendered-plain-links',
},
ssrRouterLinkLoad: { ...ssrLoad },
ssrRouterLinkLoad: { status: 'live', ...ssrLoad },
clientSideRendered: {
status: 'live',
runs: 5,
scenario: interactionScenarioLabel,
path: '/client-side-rendered',
},
serverSideRendered: {
status: 'live',
runs: 5,
scenario: interactionScenarioLabel,
path: '/server-side-rendered',
},
initialLoad: {
status: 'live',
path: '/initial-load',
},
} as const
} as const satisfies Record<
string,
{ status: MeasurementStatus; [setting: string]: unknown }
>

export type MeasurementName = keyof typeof measurementsConfig
Loading