feat(bench): benchmark targets, baselines and regression gates (G1, G8)
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m43s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m49s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 7s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m16s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m22s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m49s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m1s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m46s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 18s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m4s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m4s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s

- p.benchmark(name) adds the `benchmark` target kind, built and linked
  like an executable (graph lowering, compdb, IDE runnables and the
  installer default destination all handle it).
- vbs bench builds only the benchmark targets (or the --target subset),
  runs each binary --samples times (default 3) with VBS_BENCH=1, keeps the
  best wall-clock time, and compares against --baseline
  (default <build>/.vbs/bench_baseline.json) with --max-regression PCT
  (default 5). The first run records the baseline; --update-baseline
  rewrites it while merging entries for benchmarks not selected.
- Baselines carry os/architecture/compiler/profile; comparison across
  machines warns and skips the gate instead of failing noisy CI.
- --json FILE writes a schema-versioned results document (per-benchmark
  status, samples, baseline, regression percent).
- vbs metadata bumps to schema v2 (new `benchmark` kind, corrected
  `header_only` enum); metadata-v1.schema.json is retained per the
  schema versioning rule, and the schema test fixture now declares a
  benchmark target.

Verified: bench_records_baseline_and_enforces_regression_gate covers
recording, passing, crafted-slow/fast baselines, JSON results,
--update-baseline, machine mismatch, no-benchmark and invalid options;
the schema test passes against v2; vbs_core_tests 8/8; CLI contracts
pass; clang-format clean.
This commit is contained in:
faumaray committed 2026-12-06 20:37:33 +03:00
1 parent f1cf277847
commit 7365279cf3
16 files changed
+921 -25

No files matched your search

+154
View File
@@ -0,0 +1,154 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://void.build/schemas/metadata-v2.schema.json",
"title": "VoidBuildSystem workspace metadata (schema_version 2)",
"description": "Emitted by `vbs metadata`. Any shape change bumps schema_version and adds a new schema file.",
"type": "object",
"required": [
"schema_version",
"project_root",
"build_root",
"profile",
"compiler",
"os",
"architecture",
"features",
"targets",
"dependencies",
"lockfile"
],
"additionalProperties": false,
"properties": {
"schema_version": { "type": "integer", "enum": [2] },
"project_root": { "type": "string" },
"build_root": { "type": "string" },
"profile": { "type": "string" },
"compiler": { "type": "string" },
"os": { "type": "string" },
"architecture": { "type": "string" },
"features": {
"type": "array",
"items": {
"type": "object",
"required": ["name", "default_on", "description", "enabled"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"default_on": { "type": "boolean" },
"description": { "type": "string" },
"enabled": { "type": "boolean" }
}
}
},
"targets": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"kind",
"sources",
"include_directories",
"links",
"labels",
"required_features",
"install"
],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"kind": {
"type": "string",
"enum": [
"executable",
"static_library",
"shared_library",
"header_only",
"object_library",
"custom_action",
"test",
"benchmark"
]
},
"sources": { "type": "array", "items": { "type": "string" } },
"include_directories": {
"type": "array",
"items": {
"type": "object",
"required": ["path", "visibility"],
"additionalProperties": false,
"properties": {
"path": { "type": "string" },
"visibility": { "type": "string", "enum": ["public", "private"] }
}
}
},
"links": {
"type": "array",
"items": {
"type": "object",
"required": ["target", "dependency", "visibility"],
"additionalProperties": false,
"properties": {
"target": { "type": "string" },
"dependency": { "type": "string" },
"visibility": { "type": "string", "enum": ["public", "private"] }
}
}
},
"labels": { "type": "array", "items": { "type": "string" } },
"required_features": { "type": "array", "items": { "type": "string" } },
"install": {
"type": ["object", "null"],
"required": ["destination", "component"],
"additionalProperties": false,
"properties": {
"destination": { "type": "string" },
"component": { "type": "string" }
}
}
}
}
},
"dependencies": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"source",
"package",
"version",
"builder",
"registry",
"features",
"build_dependency"
],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"source": {
"type": "string",
"enum": ["git", "package", "path", "archive", "conan", "pkgconfig", "unspecified"]
},
"package": { "type": "string" },
"version": { "type": "string" },
"builder": { "type": "string" },
"registry": { "type": "string" },
"features": { "type": "array", "items": { "type": "string" } },
"build_dependency": { "type": "boolean" }
}
}
},
"lockfile": {
"type": "object",
"required": ["path", "exists"],
"additionalProperties": false,
"properties": {
"path": { "type": "string" },
"exists": { "type": "boolean" },
"revision": { "type": "string" }
}
}
}
}