Repository navigation
Conversation
e6ddd7f to
ad02632
Compare
ad02632 to
9c88d5c
Compare
| ) -> impl Iterator<Item = Result<String, DecodeError>> + 'm { | ||
| self.message | ||
| .all(name) | ||
| .map(|header| header.decoded_value().map(Cow::into_owned)) |
There was a problem hiding this comment.
[P2] Preserve decoding errors in short-circuiting callers
Moving decoding into the iterator changes validation behavior. With otherwise valid metadata containing Dynamic: Version followed by Dynamic: =?utf-8?b?Y?=, parse_metadata now breaks before decoding the malformed value and succeeds; previously it returned DecodeError::InvalidBase64. Similarly, parse_pkg_info can return DynamicField before encountering a later decoding error, causing StaticMetadata::read to fall back to building instead of propagating the error. A requirement-parsing error can now mask a later decoding error too. Preserve decoding-error precedence by consuming the remaining matching headers before returning the saved semantic result or error, and cover a malformed later header in the tests.
Merging this PR will not alter performance
|
Headers::get_all_valuesdecodes and collects matching header values into aVecbefore returning an iterator. Decode values as they are consumed fromastral_mail_headers::Message::all, retaining theUNKNOWNfilter, and update metadata consumers to handle the fallible iterator.Hyperfine 2.0.0 measurements of 763ac4abc → bc73f174d used release builds of the complete CLI with
rustc 1.99.0 (b940084d7 2026-09-28)on an AMD EPYC-Genoa Linux VM, pinned to four CPUs. Output went to/dev/null.Fresh
uv pip show bench-header --python <environment-python> --offlineprocesses read one synthetic installed distribution in a CPython 3.12.13 environment. ItsMETADATAcontains zero to 10,000 activeRequires-Distheaders, 100,000 Windows-only requirements, 10,000Provides-Extraheaders, or 10,000 of each Windows-only requirement and extra header. The Windows-only requirements are inactive on the Linux host.OS pages and interpreter-query caches are warm. The complete command includes environment indexing, metadata and header parsing, requirement and extra parsing, marker evaluation and output formatting.
Values are means, parent → head. Changes are
(head / parent - 1)with 95% confidence intervals; negative values indicate a reduction.Each workload used ten comparison blocks with alternating revision order, one warmup followed by three measured runs per revision in each block (30 measurements per revision). The pointwise 95% percentile-bootstrap intervals use 20,000 resamples of paired block means and retain all samples. They estimate within-run uncertainty, not variation across machines, independent builds, or separate benchmark campaigns.
Wall time fell by 5.49% for 100,000 Windows-only requirements, 5.27% for 10,000 extra headers and 3.69% for the mixed case. It also fell by 3.25% for 1,000 active requirements and 2.20% in the zero-requirement control; the other two intervals include zero. Peak RSS fell by 7.26% for the 100,000-requirement case and by 0.27–1.22% for 10,000 active requirements, 10,000 extras and the mixed case; the other three RSS intervals include zero. These complete-command results do not isolate header iteration. RSS is Hyperfine's Linux
wait4peak, not an allocation count or summed simultaneous process-tree memory.