To add a new performance benchmark, you must modify scenarios.mjs. The process involves three steps:
- Setup: Add any required one-time setup commands to the
performanceSetup array in scenarios.mjs. - Scenario Definition: Add a new scenario object to the
performanceScenarios array. - Implementation: Add implementations to the scenario that execute an adapter command. Each implementation must report a single numeric value using
reportPerformanceSample(value).
Scenario Object Schema:
id: Unique identifier for the scenario.suite: The category of the benchmark.label: Human-readable name.description: Detailed description.unit: The measurement unit (e.g., ms).lowerIsBetter: Boolean indicating if a lower value is preferable.implementations: An array of implementation objects:id: Unique identifier for the implementation (the full ID is <implementation id>-<scenario id>).label: Human-readable name.profile: Boolean. Set to true to enable subprocess tree sampling (e.g., for vinext traces).command: The command array to execute.compareBase: Boolean. If true, the implementation is measured at both the PR base and head.
No changes to workflows, databases, APIs, normalizers, or dashboards are required.
{
id: "production-build",
suite: "Build",
label: "Production build time",
description: "Clean production build.",
unit: "ms",
lowerIsBetter: true,
implementations: [
{
id: "vinext",
label: "vinext",
profile: true,
command: ["node", "benchmarks/perf/build-time.mjs", "vinext"],
},
],
}