Repository navigation
Harden inline-container safety and reduce query/text allocations - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inline storage exposed a safe raw-mutation method that could invalidate initialized values, and map spill could double-drop moved storage if Hash/Eq panicked. Make raw mutation explicitly unsafe, track the initialized prefix before moving entries, and clean up partial Clone results on unwind. Fix Bytes ordering to agree with content-based equality and make inline map replacement consistent with heap behavior; retain the first ordinary HTML attribute.
Remove per-anchor Context clones in :has by passing a borrowed scope boundary. Flatten decoded-text extraction into one output buffer and borrow unchanged single leaves. Add regression tests, Criterion/probe workloads, path-filtered CI for default/std/entities, Rust 1.92 and pinned nightly SIMD, plus optional manual Miri. Update API/installation/safety/performance documentation.
Validation: 89 unit tests with entities, 86 with std, 3 bounded default tests plus doctests; strict all-targets Clippy in default/entities without allowances; rustdoc with -D warnings; Rust 1.92 all-target compatibility; nightly SIMD tests; benchmark smoke checks, formatting, YAML and relative links. Focused Miri groups passed 7 + 7 + 22 test executions (some overlap). Baseline tests independently reproduce incorrect Bytes ordering, both clone leaks and duplicate map replacement. Pedantic review was inspected; unrelated style warnings remain.
Measured 200-row warm-DOM operations on the same shared x86_64 host/compiler/lockfile, Criterion 0.3.6, 100 samples, 3 s warmup/5 s measurement, two runs per revision:
These are exploratory operation-specific results, not general parser/crawler speed guarantees. Repeated raw parsing comparisons were small/mixed (Example Domain changed sign, PyPI no significant change then about -2.7%); no general parsing speedup is claimed. See docs/rust-audit.md for confidence intervals, measurement boundaries, scope and reproduction commands.
Compatibility: inline_parts_mut now requires unsafe, intentionally closing a safe-API soundness hole. Publish with the already-planned breaking 0.3.x release; no version bump, tag or publication is performed here. Full HTML5 recovery and silkworm's scraper::Selector migration remain outside this change. Remote CI results are separate from local validation.