Prepare configuration scope metadata
This commit is contained in:
@@ -779,7 +779,7 @@ allocation costs, with timing variation on repeated success and deep dispatch.
|
||||
|
||||
## Stage 10: prepare configuration scope metadata once
|
||||
|
||||
**Status:** not started. **Prerequisite:** Stage 9.
|
||||
**Status:** complete. **Prerequisite:** Stage 9.
|
||||
|
||||
**Files:** [config.go](../../config.go), [selectors.go](../../selectors.go),
|
||||
configuration handler files, configuration/cancellation tests, scope benchmarks,
|
||||
@@ -821,7 +821,58 @@ Preserve native reporting and per-operation output timing.
|
||||
scope lookup is indexed, and duplicate selector checks are linear in selector
|
||||
count plus declared scope references.
|
||||
|
||||
**Evidence:** pending.
|
||||
**Evidence:** `GOWORK=off GOTOOLCHAIN=local GOPROXY=off GONOPROXY=none
|
||||
GOSUMDB=off go test -mod=readonly -count=1 .` passed, including existing
|
||||
configuration, selector, discovery, and cancellation behavior. Added coverage
|
||||
that caller mutations to scope and selector slices after registration do not
|
||||
change discovery, capability selection, or projected inputs, and that duplicate
|
||||
selector names and short names retain their error category. Registration now
|
||||
normalizes owned metadata, prepares the ordered scopes, name index, installed
|
||||
operation list, and discovery DTO once, then passes that private value through
|
||||
validate/show/sources/explain and their preflight/run paths. Aggregate selection
|
||||
checks every capability using the prepared metadata before any acquisition.
|
||||
`NewContext`, acquisition, checks, native writers, and encoding are not called
|
||||
while preparing the suite. Discovery renders the retained DTO at invocation
|
||||
time. Scope sorting occurs once, named lookup uses the map, and duplicate
|
||||
selector validation uses seen-name/seen-short maps while preserving validation
|
||||
order and deduplicating scope references. Public `ConfigSuite` and `ConfigScope`
|
||||
declarations and signatures are unchanged.
|
||||
|
||||
Measurements used Go 1.26.8, linux/amd64, Linux 6.17.0-41-generic, Intel Core
|
||||
i5-7260U CPU @ 2.20 GHz, based on source revision `a7960e5` with this stage's
|
||||
changes in the working tree. The five-sample command passed:
|
||||
`GOWORK=off GOTOOLCHAIN=local GOPROXY=off GONOPROXY=none GOSUMDB=off go test -mod=readonly -run '^$' -bench '^BenchmarkPerformance(ConfigScopes|ConfigRegistration)$' -benchmem -benchtime=200ms -count=5 .`.
|
||||
Raw output is in `/tmp/commandkit-performance-config-after-stage10.txt`;
|
||||
focused repeats for selector-heavy registration and the ordinary two-scope
|
||||
aggregate are in `/tmp/commandkit-performance-config-registration-repeat.txt`
|
||||
and `/tmp/commandkit-performance-config-two-scope-repeat.txt`.
|
||||
|
||||
Against Stage 2, two-scope discovery measured 16,788–21,062 ns/op, 18,557
|
||||
B/op, and 195 allocations (baseline: 23,840–30,007 ns/op, 21,161–21,162
|
||||
B/op, 223 allocations). Named selection measured 18,375–21,756 ns/op,
|
||||
19,621 B/op, and 207 allocations (baseline: 24,841–26,340 ns/op, 21,817
|
||||
B/op, 228 allocations). Two-scope aggregate validation measured 22,977–28,152
|
||||
ns/op, 19,637–19,638 B/op, and 208 allocations in the focused repeat (baseline:
|
||||
25,231–31,126 ns/op, 22,361–22,362 B/op, 237 allocations).
|
||||
|
||||
At 32 scopes, discovery measured 18,253–20,311 ns/op, 21,070 B/op, and 199
|
||||
allocations (baseline: 31,439–37,167 ns/op, 28,141–28,142 B/op, 257
|
||||
allocations). Named selection measured 18,679–20,529 ns/op, 20,582 B/op, and
|
||||
207 allocations (baseline: 29,123–74,374 ns/op, 22,775–22,778 B/op, 228
|
||||
allocations). Aggregate validation measured 25,036–33,981 ns/op, 22,702 B/op,
|
||||
and 240 allocations (baseline: 45,548–63,471 ns/op, 29,781–29,782 B/op, 269
|
||||
allocations).
|
||||
|
||||
Registration with 4 selectors measured 11,272–14,623 ns/op, 9,310 B/op, and
|
||||
107 allocations (baseline: 12,573–14,789 ns/op, 8,911 B/op, 104 allocations).
|
||||
With 64 selectors, the focused repeat measured 72,002–74,712 ns/op, 90,197–
|
||||
90,200 B/op, and 494 allocations (baseline: 91,675–105,548 ns/op,
|
||||
82,817–82,818 B/op, 485 allocations). The retained ordered slice, lookup map,
|
||||
and discovery DTO add registration storage: about 399 bytes and 3 allocations
|
||||
for 4 selectors, and 7.4 KiB and 9 allocations for 64 selectors. Selector-heavy
|
||||
registration timing improved in the focused repeat; execution ranges improved
|
||||
for discovery and named/aggregate selection. These benchmark timings vary and
|
||||
are observations, not thresholds.
|
||||
|
||||
## Stage 11: audit the completed target and reconcile documentation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user