Scan YAML framing preambles once
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Performance implementation plan
|
||||
|
||||
Status: implementation in progress; Stages 1–4 are complete, Stages 5–11 have not started.
|
||||
Status: implementation in progress; Stages 1–5 are complete, Stages 6–11 have not started.
|
||||
|
||||
Date: 2026-10-09.
|
||||
|
||||
@@ -429,7 +429,7 @@ tree construction remains in each parse.
|
||||
|
||||
## Stage 5: scan YAML preambles without splitting documents
|
||||
|
||||
**Status:** not started. **Prerequisite:** Stage 4.
|
||||
**Status:** complete. **Prerequisite:** Stage 4.
|
||||
|
||||
**Files:** [show.go](../../show.go), [show_test.go](../../show_test.go),
|
||||
[configkit_test.go](../../configkit_test.go), framing benchmarks, and evidence.
|
||||
@@ -464,7 +464,33 @@ tree construction remains in each parse.
|
||||
**Completion:** each document has one opening analysis, no document-wide line
|
||||
index, and the selected complete-buffer delivery model.
|
||||
|
||||
**Evidence:** pending.
|
||||
**Evidence:** `GOWORK=off GOTOOLCHAIN=local GOPROXY=off GONOPROXY=none
|
||||
GOSUMDB=off go test -mod=readonly -count=1 .` passed. Existing aggregate tests
|
||||
continue to cover acquisition-before-output, directive document separators,
|
||||
decoded values, diagnostics, and writer failures. New framing cases cover a
|
||||
missing final newline, CRLF, a directive preamble, a control character in the
|
||||
scope label, unchanged native bytes, decoded values, and one-document output.
|
||||
|
||||
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 `ae656d8` 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 '^BenchmarkPerformanceYAMLFraming$' -benchmem -benchtime=200ms -count=5 .`.
|
||||
Raw output is in `/tmp/commandkit-performance-yaml-after-stage5.txt`.
|
||||
|
||||
Direct 4 KiB ordinary framing measured 1,135–1,455 ns/op, 4,864 B/op, and one
|
||||
allocation, compared with 5,883–6,842 ns/op, 11,056 B/op, and three allocations
|
||||
at baseline. Direct 1 MiB directive framing measured 189,303–359,655 ns/op,
|
||||
1,056,768–1,056,769 B/op, and one allocation, compared with 1,208,678–1,502,417
|
||||
ns/op, 2,539,520–2,539,523 B/op, and two allocations. Aggregate 4 KiB show
|
||||
measured 29,951–49,108 ns/op, 36,999–37,001 B/op, and 206 allocations, compared
|
||||
with 44,395–48,161 ns/op, 55,537–55,538 B/op, and 211 allocations. Aggregate
|
||||
1 MiB show measured 1,326,104–1,557,880 ns/op, 4,246,730–4,246,767 B/op, and
|
||||
211 allocations, compared with 4,818,907–6,009,877 ns/op, 8,695,182–8,695,197
|
||||
B/op, and 215–216 allocations. Single-scope 4 KiB display remained at
|
||||
17,935–17,936 B/op and 183 allocations; timing variation overlaps the baseline.
|
||||
The complete framed output still requires a full-size copy under OD-2. The
|
||||
allocation reduction comes from eliminating document-wide split/index storage
|
||||
and reusing the opening analysis for framing and aggregate directive handling.
|
||||
|
||||
## Stage 6: install validated registrations without copying the registry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user