Avoid copying unused slice capacity
This commit is contained in:
@@ -154,8 +154,11 @@ options, schema guarantees, or additional runtime validation.
|
||||
|
||||
## 4. P3 — Allocate Trusted Slice Copies By Length, Not Spare Capacity
|
||||
|
||||
Status: open; efficiency improvement for consideration. Identified by the
|
||||
algorithmic audit. Relevant stages: 1 and 6.
|
||||
Status: complete. Identified by the algorithmic audit. Relevant stages: 1 and 6.
|
||||
|
||||
Resolution: trusted slice copies allocate backing storage from the populated
|
||||
length. Internal regressions cover interface, string, byte, named, and nonnil
|
||||
empty slices with spare capacity; existing nil/empty and ownership tests remain.
|
||||
|
||||
Location: `internal/jsonvalue/trusted.go:50` in `cloneTrustedReflect`.
|
||||
|
||||
@@ -217,7 +220,8 @@ On the reviewed commit, using Go 1.27.4 with `GOTOOLCHAIN=local` and `GOWORK=off
|
||||
- The separate public-API reproduction above confirmed the ownership bug not
|
||||
covered by the passing suite.
|
||||
|
||||
This review changes no implementation code.
|
||||
The review itself changed no implementation code. Completed remediations are
|
||||
recorded under the findings above.
|
||||
|
||||
### Follow-Up Integration Audit
|
||||
|
||||
@@ -253,3 +257,11 @@ checks and compiler behavior, and existing hash algorithms were not reopened.
|
||||
No additional ordinary correctness issue was found beyond the recorded findings.
|
||||
No real-world performance data, timing measurements, or profiling were collected;
|
||||
the earlier successful suite/vet results apply to unchanged implementation code.
|
||||
|
||||
## Remediation Validation
|
||||
|
||||
All four findings are complete. Focused ownership, schema, requirements,
|
||||
selection, and smoke tests passed during the corresponding fixes. The assembled
|
||||
remediations passed `go test -race ./...` (including maintained examples),
|
||||
`go vet ./...`, and `git diff --check`, using Go 1.27.4 with `GOTOOLCHAIN=local`
|
||||
and `GOWORK=off`.
|
||||
|
||||
Reference in New Issue
Block a user