I0817 — Phase timing and work counters behind MJ_TIMING
Time every validator and count every YAML flatten and git call when MJ_TIMING is set, and report them ranked at exit.
DONE wave 0 · p0 · implementation profile · runs alone
Part of M004 — Performance is executable evidence, and the hot path does no canonical work twice.
Objective
Time every validator and count every YAML flatten and git call when MJ_TIMING is set, and report them ranked at exit.
Why
Nothing else in this milestone can be measured without it; optimisation without a ranking is guessing.
Current state
Landed on feature/performance-truth as 77f5d79: the dispatcher declares one phase per validator, mj_git and mj_yaml_flatten count.
Desired state
Phases and counters are the vocabulary every later issue reports in.
Scope
- lib/common.sh
- lib/doctrine.sh
- test/cases/08_no_forbidden_constructs.sh
Out of scope
- A tracing backend
- Timing that is on when MJ_TIMING is unset
Dependencies
None. This issue is a root of the graph.
What waits on this
- I0818DONE The command registry is read in one pass
- I0819DONE The project model is loaded with one flatten per file and no per-file lookups
- I0821READY Flattened YAML is cached under .ai/local/cache by content hash
- I0823DONE majordomus bench: targets derived from the command registry
- I0832READY generate-site-data instrumented and its hot spots removed
- I0833DONE knowledge nodes and edges read each source once
- I0837READY Timing report as JSON
Acceptance criteria
- The report ranks phases by time and sums counters on stderr, with the command output untouched
- Off, a phase or a count costs one test and no subprocess
Validation
- MJ_TIMING=1 bin/majordomus doctor
- bash test/run.sh 08_no_forbidden_constructs
Evidence required
- phase_timing
Evidence
| covers | type | command | result | at commit |
|---|---|---|---|---|
| phase_timing | test | MJ_TIMING=1 bin/majordomus doctor | the report on stderr ranks one phase per validator and sums the yaml_flatten and git counters; on this repository the two largest phases are the project-model and command-coverage validators, together two thirds of doctor's total; case 08 accepts the timing file as a scratch path; cases 02, 14, 17 and 18 pass unchanged | 77f5d79 |
Risk
The clock is EPOCHREALTIME where bash has it and perl otherwise; whole seconds where neither exists, and the report says which.
Timeline
- started
- 2026-09-05T01:35:00Z
- verified
- 2026-09-05T01:44:00Z
- completed
- 2026-09-05T01:44:00Z
Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.
Canonical record: .ai/repo/project/issues/I0817.yaml. Read it back with majordomus plan show I0817.