perf: time the execution path, not the opt-in Observation document
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/manual/performance Pipeline was successful

The first rc.3 perf comparison reused the old workload commands but switched
them to `run/call --output json`, so the candidate was timed while producing
thousands of structural events that the beta baseline never emitted. The result
was a reproducible +240..+375% p50 and +130% RSS delta caused by the
measurement, not by the program's execution cost.

- Give each run/call workload a correctness command (current Observation
  snapshot, full contract digest) and a measurement command (plain execution
  path, committed text digest).
- Verify the correctness digest once per workload and the measurement digest on
  every timed sample; a wrong or changed output is never timed.
- Re-record the expected digests and extend the tooling tests.
- A protocol document that is produced only on request must not be billed as
  an execution regression.
This commit is contained in:
cflmy committed 2026-11-24 22:25:30 +08:00
1 parent f211568c42
commit 1e2a045cc7
12 files changed
+223 -57

No files matched your search

+21
View File
@@ -80,6 +80,20 @@ class WorkloadCatalogueTest(unittest.TestCase):
self.assertIn("--json", argv)
class DualCommandWorkloadTest(unittest.TestCase):
def test_run_and_call_workloads_separate_correctness_from_timing(self):
catalogue = json.loads(WORKLOADS.read_text(encoding="utf-8"))
for workload in catalogue["workloads"]:
if workload["kind"] not in ("run", "call"):
self.assertNotIn("measure_argv", workload)
continue
measure = workload.get("measure_argv")
self.assertIsNotNone(measure, f"{workload['name']} lacks measure_argv")
self.assertNotIn("--output", measure)
self.assertNotIn("--json", measure)
self.assertEqual(measure[0], workload["argv"][0])
class DigestStabilityTest(unittest.TestCase):
def setUp(self):
self.runner = load_runner()
@@ -106,6 +120,13 @@ class DigestStabilityTest(unittest.TestCase):
self.runner.wire_digest(document), self.runner.wire_digest(truncated)
)
def test_measured_text_digest_ignores_the_checkout_path(self):
runner = self.runner
first = runner.text_digest(b"output 120\n")
second = runner.text_digest(b"output 120\n")
self.assertEqual(first, second)
self.assertNotEqual(first, runner.text_digest(b"output 121\n"))
def test_check_document_keeps_the_command_digest(self):
report = {
"command": "check",