perf: decode the content in `ReadAllText` without a `StreamReader` when it has no byte order mark #1261
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.32) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 126 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.290
Real PR Conversation Timeline
1 comments
"Review active on #1261"
general
weight: 0.35
greptile-apps[bot]
ReadAllText(and therebyReadAllLinesandReadLines) decoded the content through aMemoryStreamand aStreamReader, whose buffers andStringBuilderallocate about twice the size of the result.A
StreamReaderonly behaves differently fromEncoding.GetStringwhen the content starts with the preamble of the encoding or a UTF-8/16/32 byte order mark, which all start with0xEF,0xFE,0xFFor0x00. When the first byte is none of these, the bytes are now decoded directly; otherwise theStreamReaderis still used. On .NET Framework theStreamReaderdrops incomplete trailing bytes (e.g.41 C3reads asAinstead ofA\uFFFD), so the fast path is not used there. A new test checks that invalid and incomplete UTF-8 decodes exactly like aStreamReader.Benchmarks on Linux against
main: