Use chunked fills to optimize buffered padding #4959
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 403 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4959"
general
weight: 0.35
Boulea7
Fill appender padding in chunks
Padding through
basic_appendercurrently writes one buffer element at a time. This adds afill_noverload that fills contiguous buffer space, continuing after growth or flushing.Also adds tests for large counting/truncated output and non-ASCII wide fills.
All speedups are C++20 and later only, because we have to fall back to the old slow path when we don't have
std::is_constant_evaluated.Benchmarks
4 cases, timed separately. The first three cycle through 256 runtime-generated
unsignedvalues below 100,000,000. Comments show untimed setup;valueshows one example input.The first 3 cases are microbenchmarks; the 4th case is intended to mimic a more realistic/common usecase.
Performance
Compiled with
-std=c++20 -O3 -DNDEBUG. Library and consumer compiled separately (without lto).Elapsed-time reductions, using 4 compilers and 3 different computers:
| CPU | Compiler | Buffer | Size | Truncate | Listing |
|---|---|---:|---:|---:|---:|
| Ryzen 9 9950X | GCC 11.5.0 | 96.28% | 94.52% | 89.82% | 14.41% |
| Ryzen 9 9950X | GCC 16 snapshot | 96.99% | 95.33% | 92.68% | 14.87% |
| Ryzen 9 9950X | Clang 17.0.6 | 95.87% | 93.79% | 89.33% | 8.28% |
| Ryzen 9 9950X | Clang 22.1.2 | 96.25% | 94.25% | 90.19% | 13.26% |
| Core i5-1230U | GCC 11.5.0 | 96.66% | 93.83% | 89.34% | 17.37% |
| Core i5-1230U | GCC 16 snapshot | 95.55% | 92.91% | 88.41% | 20.10% |
| Core i5-1230U | Clang 17.0.6 | 96.77% | 94.15% | 90.05% | 11.87% |
| Core i5-1230U | Clang 22.1.2 | 96.78% | 93.88% | 90.24% | 18.02% |
| Core i5-6600 | GCC 11.5.0 | 97.84% | 96.43% | 93.68% | 20.62% |
| Core i5-6600 | GCC 16 snapshot | 97.23% | 96.05% | 93.51% | 21.66% |
| Core i5-6600 | Clang 17.0.6 | 97.92% | 96.95% | 94.35% | 19.70% |
| Core i5-6600 | Clang 22.1.2 | 97.86% | 96.91% | 94.42% | 18.30% |
So ~10-40x faster on microbenchmarks, and ~8-20% less elapsed time on the 4th benchmark.
GCC 16 is the 20260322 snapshot; Clang 17 uses GCC 14 headers.
Each comparison uses 24 randomized, balanced process pairs, with CPU pinning and warmups. All 48 per-comparison 99% confidence intervals exclude zero.
The
format.cccode-size increases were 48–135 bytes, at most ~0.12%.A broader set of benchmarks found no regressions in performance anywhere (except for in cases where code layout had significant performance implications).