Skip prefix checks that cannot match the first byte of the input #659
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 275 lines diff across 3 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.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #659"
general
weight: 0.35
juntyr
CHANGELOG.mdThe parser tries some fixed prefixes in a row before it parses a value. Each try calls
check_str, and most tries cannot match. This PR adds a check of the first byte before each group of tries. The output and the errors do not change.There are three commits. You can take each commit alone:
1.
deserialize_anytries 10 keywords, such astrue,Some,inff32andNaN, and the unit(). All of them start witht,f,S,N,ior(.2.
identifierandskip_identifiertry 7 string literal prefixes, such asb"andr#". All of them start withborr. The two copies of the check are now one helper.3.
floattries 6infandNaNliterals. All of them start withiorNafter an optional sign.| Input | Before | After | Change |
|---|---:|---:|---:|
|
Value, Bevy scenes and assets | 59.9 µs | 44.0 µs | −27% ||
Value, Oxide PMBus configs | 2.36 ms | 1.74 ms | −26% ||
Value, Veloren items | 954 µs | 701 µs | −26% ||
Value, Veloren manifests | 16.7 ms | 12.8 ms | −23% ||
IgnoredAny, Veloren entities | 973 µs | 693 µs | −29% || Typed scene, 2,000 entities | 4.92 ms | 3.83 ms | −22% |
| Typed
Vec<f64>| 60.9 µs | 41.1 µs | −33% |The table compares
masterwith all the commits of this PR. I measured 8 groups of real files (722 files). On all of them,Valueis 21% to 30% faster andIgnoredAnyis 25% to 34% faster. Serialization does not change. I also measured inputs that still go through the checks, for exampletrue,Some(..),NaN,r#identandb"...". I measured no significant slowdown. A comparison of the old code with itself gave differences of up to ±5%. I used 12 interleaved rounds of criterion and a Mann-Whitney test (Apple Silicon, rustc 1.98). I did not measure other architectures.Checks:
cargo test --all-targetspasses with the CI feature sets, and on 1.64 with minimal versions.cargo fmtpasses.cargo clippyshows no new warnings.from_strfuzz target ran for 5 minutes with no failure.Value,IgnoredAnyand typed targets, with and without extensions, including the error positions.