Repository navigation
Reduce ASC formatting and ISO-TP fr 8000 ame allocations - #84
Merged
Merged
Conversation
WriteFrame built every record through fmt.Fprintf and strings.Builder, paying reflection and boxing per field and once per payload byte. Build the body into a reusable scratch with strconv appends and a hex table, and emit the fixed timestamp prefix from the same helpers. Output is byte-identical; the streams test pins every line. Amp-Thread-ID: https://ampcode.com/threads/T-01a0bfe9-fc6d-752f-a896-035e03901034 Co-authored-by: Amp <amp@ampcode.com>
tomrford
marked this pull request as ready for review
September 20, 2026 20:33
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ASC writing formats every payload byte through fmt and allocates temporary record strings. Build the complete line, including its timestamp, in a reusable byte buffer; share classical data/remote formatting and preserve the emitted bytes. ISO-TP consecutive-frame construction and padding use local fixed-size arrays, retaining the existing padding logic. Extract the repeated newest-cursor lookup from Capture reads.
On Apple M4 with Go 1.26.6, three-run microbenchmarks measured:
ASC benchmarks cover steady-state formatting to io.Discard. ISO-TP figures isolate frame construction. Capture read benchmarks remained close to main.
Validation:
go test -race ./...,go vet ./..., formatting and diff checks.Net change: 64 production lines and 75 test/benchmark lines.