Skip to content

benchmark cpu: fixed-width duration column - #10324

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:bench-duration-align
Sep 3, 2026
Merged

benchmark cpu: fixed-width duration column#10324
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:bench-duration-align

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

The elapsed time was printed with a variable width ({dt:.3f}s, so 1.823s vs. 92.361s), which misaligned everything right of it — throughput and ratio — as soon as one row took >= 10s. Slow codecs at high compression levels easily do:

$ borg benchmark cpu --compressing --data ~/silesia
Compression ==========================================================
zstd,5 (128kiB)            200.38 MiB  1.823s     115.3 MB/s    3.04x
zstd,10 (128kiB)           200.38 MiB  5.458s      38.5 MB/s    3.16x
zstd,16 (128kiB)           200.38 MiB  36.432s       5.8 MB/s    3.37x
zstd,22 (128kiB)           200.38 MiB  92.361s       2.3 MB/s    3.38x

Now a duration_str() helper reserves 8 chars, right-aligned ({dt:>7.3f}s), which fits up to 999.999s. Applied to both duration columns — report() and the msgpack row, which had the same format — and the section header rule grows 70 -> 71 to keep covering the longest rows again.

After:

Compression ===========================================================
zstd,5 (128kiB)            200.38 MiB    1.823s     115.3 MB/s    3.04x
zstd,10 (128kiB)           200.38 MiB    5.458s      38.5 MB/s    3.16x
zstd,16 (128kiB)           200.38 MiB   36.432s       5.8 MB/s    3.37x
zstd,22 (128kiB)           200.38 MiB   92.361s       2.3 MB/s    3.38x
msgpack ===============================================================
msgpack                    128k Items    0.051s    2522.0 kItems/s

JSON output is unaffected.

🤖 Generated with Claude Code

The elapsed time was printed with a variable width ("1.823s" vs. "92.361s"),
so everything right of it (throughput, ratio) got misaligned as soon as one
row took >= 10s - which slow codecs at high compression levels easily do.

Reserve 8 chars and right-align, that fits up to 999.999s. The section header
rule grows by one char accordingly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.65%. Comparing base (9d831da) to head (e861c72).
⚠️ Report is 16 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10324      +/-   ##
==========================================
- Coverage   87.70%   87.65%   -0.05%     
==========================================
  Files         103      103              
  Lines       18717    18716       -1     
  Branches     2881     2881              
==========================================
- Hits        16415    16405      -10     
- Misses       1600     1609       +9     
  Partials      702      702              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit cce9a6c into borgbackup:master Sep 3, 2026
21 of 23 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the bench-duration-align branch September 4, 2026 00:12
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.

1 participant