Skip to content

feat: report bytes saved in the diff header#57

Merged
peczenyj merged 1 commit into
develfrom
feat/header-bytes-saved
May 27, 2026
Merged

feat: report bytes saved in the diff header#57
peczenyj merged 1 commit into
develfrom
feat/header-bytes-saved

Conversation

@peczenyj
Copy link
Copy Markdown
Owner

The diff header showed only a percentage, but -threshold filters by absolute bytes saved — so there was no number to read off when deciding what threshold to pass. Now the header surfaces it:

Mixed: struct of size 24 could be 16, saving 8 bytes (33.33% smaller)

The "struct of size 24 could be 16" portion is the upstream analyzer's message (verbatim); structalign appends , saving N bytes (pluralized) before the existing (NN.NN% smaller) suffix, under the same condition (both sizes known and the proposal smaller).

Test plan

  • internal/ui/printer_test.go: assertion tightened to saving 8 bytes (33.33% smaller).
  • Both diff golden fixtures regenerated (diff_unified_mixed.golden, diff_side_mixed.golden) — the only change is the header line; inspect goldens untouched.
  • README examples updated to match.
  • task ci green (154 tests, 0 lint issues); verified against ./_example.

Closes #56

🤖 Generated with Claude Code

The diff header showed only a percentage, but -threshold filters by absolute
bytes saved — so there was no number to read off when choosing a threshold.
Append ", saving N bytes" (pluralized) before the existing "(NN.NN% smaller)"
suffix, under the same condition (both sizes known and the proposal smaller).

  Mixed: struct of size 24 could be 16, saving 8 bytes (33.33% smaller)

Updates the two diff golden fixtures and the README examples.

Closes #56

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@peczenyj peczenyj merged commit c2a3d5d into devel May 27, 2026
6 checks passed
@peczenyj peczenyj deleted the feat/header-bytes-saved branch May 27, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diff header: report absolute bytes saved (helps choose -threshold)

1 participant