# parse-net v0.6.0 - Optimisation
**Date:** 2026-10-22
**Compare:** [`v0.5.0...v0.6.0`](https://github.com/jamesgober/parse-net/compare/v0.5.0...v0.6.0)
**Measured against the competition.** v0.6.0 benchmarked every compared operation against the Rust crates that do the same work (`mime`, `httpdate`, `sfv`, `headers`, `content_disposition`, `mailparse`) on real traffic shapes, and made the slow paths fast. parse-net is now faster on every compared row, 10 of the 12 by at least the 20% the plan asks for, while validating every byte and allocating nothing. The API did not change.
## Highlights
| `check_field_value`, 64 bytes | 5.4 ns | 26.0 ns | 79% |
| `sfv::parse_list`, 10 members | 387 ns | 1058 ns (`sfv`) | 63% |
| `HttpDate::format` | 19.7 ns | 51.4 ns (`httpdate`) | 62% |
| `MailDate::parse` | 22.0 ns | 54.0 ns (`mailparse`) | 59% |
| `if_none_match`, 3 tags | 18.1 ns | 32.4 ns (`headers`) | 44% |
| `best_media`, Chrome `Accept` | 461 ns | 705 ns (`mime` and a loop) | 35% |
| `parse_content_disposition` with `filename*` | 158 ns | 206 ns (`content_disposition`) | 23% |
| `byte_ranges` | 27.8 ns | 36.1 ns (`headers`) | 23% |
| `response_cache_control` | 47.8 ns | 58.7 ns (`headers`) | 19% |
| `parse_media_type` and `charset` | 32.0 ns | 38.4 ns (`mime`) | 17% |
The full table, the method, the machine, and the commands are in `docs/PERFORMANCE.md`.
## Changed
- Entity-tag lists, `Cache-Control`, and range sets are validated and read in one pass by a walker for their own grammar, instead of the general list walker followed by a second parse of each element (D-067). `if_none_match` went from 63 ns to 18 ns; `byte_ranges` from 40 ns to 28 ns.
- `best_media` validates the header in the same pass that scores the offers, touches only the offer slots in use, and compares exact forms before ignoring case: 861 ns to 461 ns (instructions per call 20,161 to 10,903).
- `MailDate::parse` reads the canonical form mailers write (`Wed, 21 Oct 2026 17:38:00 +0200`) by position, and falls back to the general parser for anything else: 54 ns to 22 ns (D-068).
- `client_address` reads `X-Forwarded-For` IPv4 members with a byte-level parser of `core`'s rules, and no longer tries IPv6 first: 196 ns to 110 ns.
- `encode_words` builds each encoded word on the stack from a byte-length table: 271 ns to 187 ns.
- `Cache-Control` directive names are dispatched on length; `Params::get` and `MediaRange::matches` compare exact bytes before the case-insensitive comparison.
## Testing
- Two new property tests prove the fast paths change nothing: the `MailDate` fast path gives the same result or the same error as the general parser on canonical dates and on canonical dates with one corrupted byte; the `X-Forwarded-For` IPv4 reader accepts exactly what `core::net::Ipv4Addr` accepts.
- Every unit, doctest, property, conformance, and counting-allocator test passed unchanged, so the rewritten walkers keep their error kinds and their no-allocation guarantee.
- CI gained a job that builds the benchmark crate.
## Performance notes
- `parse_media_type` (17%) and `response_cache_control` (19%) are below the 20% target. Both spend their remaining time in the shared parameter and word walkers; rewriting those is planned with the 0.7 hardening work, where the 24-hour fuzz and complexity suites run over it (D-069).
- Wall-clock numbers on the benchmark machine vary by up to 15% between identical runs, for both sides; every comparison is from one run. Instruction counts from callgrind confirmed each change.
## Compatibility
- No API change. MSRV 1.85, edition 2024, `no_std` without `alloc`, zero runtime dependencies.
- The benchmark crate is excluded from the published package and is its own workspace, so its competitor dependencies never reach a parse-net build (D-066).
## Verification
- Local gate on Windows and WSL Ubuntu, Rust 1.99 and 1.85: format, clippy with default, all, and no default features under `-D warnings`, tests in the same three modes, documentation with default and all features under `-D warnings`, the bare-metal build, and `cargo package` in a fresh target directory.
- Banned-content and link checks over every shipped file.
## What's next
`0.7.0`: hardening. Every fuzz target 24 hours clean, the attack tests T1 to T25, complexity tests at 1 KiB, 64 KiB, and 1 MiB, `docs/SECURITY.md` and `docs/PLATFORM-NOTES.md`, and the parameter-walker rewrite that brings the last two rows to target.
**Full Changelog:** https://github.com/jamesgober/parse-net/compare/v0.5.0...v0.6.0