Index backend commands for path lookup
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Performance implementation plan
|
||||
|
||||
Status: implementation in progress; Stages 1–3 are complete, Stages 4–11 have not started.
|
||||
Status: implementation in progress; Stages 1–4 are complete, Stages 5–11 have not started.
|
||||
|
||||
Date: 2026-10-09.
|
||||
|
||||
@@ -376,7 +376,7 @@ construction; text requests retain their report semantics and formatting errors.
|
||||
|
||||
## Stage 4: index backend declarations and traverse parents
|
||||
|
||||
**Status:** not started. **Prerequisite:** Stage 3.
|
||||
**Status:** complete. **Prerequisite:** Stage 3.
|
||||
|
||||
**Files:** [adapter](../../internal/cobra/parse.go),
|
||||
[adapter tests](../../internal/cobra/parse_test.go), relevant benchmarks, and
|
||||
@@ -402,7 +402,30 @@ parse and dispatch benchmarks.
|
||||
**Completion:** declaration lookup uses the index and ancestry traversal is
|
||||
proportional to selected depth after backend construction.
|
||||
|
||||
**Evidence:** pending.
|
||||
**Evidence:** `go test -mod=readonly -count=1 ./internal/cobra .` passed with
|
||||
the common offline environment settings. The focused test covers a 24-level
|
||||
path, 128 siblings, root selection, unknown help/usage paths, and exact help and
|
||||
usage resolution. Existing exact-path and parse failure tests remain in place.
|
||||
|
||||
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 `628dc78` with this stage's
|
||||
changes in the working tree. The five-sample adapter command was
|
||||
`GOWORK=off GOTOOLCHAIN=local GOPROXY=off GONOPROXY=none GOSUMDB=off go test -mod=readonly -run '^$' -bench '^BenchmarkPerformanceParse$' -benchmem -benchtime=200ms -count=5 ./internal/cobra`;
|
||||
the dispatch command used the same flags with `-bench
|
||||
'^BenchmarkPerformanceDispatch$' .`. Both passed. Raw outputs are in
|
||||
`/tmp/commandkit-performance-parse-after-stage4.txt` and
|
||||
`/tmp/commandkit-performance-dispatch-after-stage4.txt`.
|
||||
|
||||
Adapter shallow/wide Parse measured 149,426–171,199 ns/op,
|
||||
242,936 B/op, and 1,705 allocs/op, compared with baseline 150,918–171,598
|
||||
ns/op, 242,936 B/op, and 1,705 allocs/op. Deep Parse measured 90,608–104,770
|
||||
ns/op, 119,536 B/op, and 826 allocs/op, compared with baseline 86,282–109,697
|
||||
ns/op, 119,920 B/op, and 827 allocs/op. Timings overlap; deep parsing saves
|
||||
384 B and one allocation. End-to-end dispatch allocations remain effectively
|
||||
unchanged across the measured cases. Timing variation, including deep-help
|
||||
outliers, is substantial, so these runs do not support an end-to-end speedup
|
||||
claim. The comparison isolates the selected-path lookup change while backend
|
||||
tree construction remains in each parse.
|
||||
|
||||
## Stage 5: scan YAML preambles without splitting documents
|
||||
|
||||
|
||||
Reference in New Issue
Block a user