Repository navigation
perf(xslt): build node-set input without a second parse - #378
Conversation
- C14N reports the structure of its canonical form to a monomorphized observer that borrows the document; existing callers pass a no-op observer and write the same octets - a node-set input to the XSLT transform is canonicalized where octet input is decoded, before the engine's workspace lease: its octets are only counted, the XML input policy limits (size, nodes, depth, namespace bindings) apply to the same counts as the preflight of those octets, and its constructs are recorded on a tape in query storage whose growth, including the reallocation peak, is admitted against the XSLT workspace before it allocates; text stays borrowed from the document, and refusals keep the precedence of octet input - after the stylesheet compiles the tape is replayed into the engine's new public Document::build_with_budget_reported and DocumentBuilder, which apply the checks, parser-work charges, lexical refusals and element projection of a parse of the canonical text in the same order, admit every name and value before copying it, and receive each run of character data whole - no conversion buffer, decode, lexical preflight or second parse remains; equivalence tests compare the built tree with the parse of the canonical octets over sampled node-sets and at every policy limit Closes #375
The shared build-cache action installs mold on Linux runners and appends -C linker-features=-lld -C link-arg=-fuse-ld=mold to RUSTFLAGS before the cache step, so cached artifacts match the flags they were built with. mold links with fewer threads and less random I/O than the self-contained rust-lld. macOS and Windows jobs keep their linkers. The alloc-only job turns it off: it also checks thumbv7em and wasm32, where rustc does not accept -C linker-features on stable.
The benchmark image installs mold and selects it per target: x86_64 turns off the self-contained rust-lld first, other targets replace the system linker. The flags are per-target so the alloc-free cross targets are untouched, and a RUSTFLAGS given to the container still wins.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7435105faf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- the node-set recorder kept the prefixes in scope and each element's binding changes outside the workspace admission; they are now lists in the same storage whose growth is admitted with the tape's, the bound prefixes a sorted list the binding policy bounds - DocumentBuilder::character_reference refuses characters XML 1.0 excludes, as a parse refuses `�` or `` - DocumentBuilder::start_element refuses `xmlns` and `xmlns:p` given as attributes, which a parse reads only as namespace declarations - the CI mold step turns rust-lld off only on x86_64 runners, the one architecture where stable accepts that flag Regression tests: namespace_bookkeeping_is_admitted_against_the_tape_limit and references_and_attributes_no_parse_reads_are_refused_when_built.
[Medium impact] The PR appears safe to merge; the latest changes address the earlier findings without introducing a new actionable issue.
|
- DocumentBuilder refuses literal text, comment, instruction, attribute and namespace values holding characters XML 1.0 production [2] excludes, as a parse does - a namespace declaration's name is admitted with its URI before the prefix is copied, as a parse admits the attribute it reads - an element past both the node and the depth limit of a node-set input is refused for the node limit, as the preflight of its octets reports Regression tests: references_and_attributes_no_parse_reads_are_refused_ when_built (non-XML characters) and an_element_over_two_limits_is_ refused_for_the_one_a_parse_reports. The prefix admission changes only the native peak and has no observable refusal to test. The XSLT 16384 verify benchmark shows no change in user CPU or minimum time.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cb8603e56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tling - DocumentBuilder checks a run for its forbidden sequence and for non-XML characters in one branch-free pass the compiler vectorizes; only a run holding a lead byte EF or the sequence's last byte takes the exact windowed pass, which also replaces the per-byte window rotation of the separate sequence scan - element projection takes the lexical name by value and frees it before the staging charge that covers it is settled, so node storage and ID registration grow within what the meter admitted, as the parser did before projection was shared; this changes only the native peak, which no refusal shows - an unprefixed element name built from parts is borrowed instead of copied XSLT 16384 verify, both run orders: user CPU 66.4/66.5 ms -> 65.3/65.0 ms, minimum 76.3/75.9 ms -> 74.9/74.1 ms. A test covers a forbidden sequence split across pieces.
Summary
Replaces #377.
Changes
c14n::serialize: a monomorphizedCanonicalObserverreceives start and end tags, text, comments, instructions and the selected axes of omitted elements, borrowing the document; existing callers pass()and write the same octets.xslt::Document::build_with_budget_reportedandxslt::DocumentBuilder(public engine API): build a sourceDocumentfrom constructs another reader has read, with the parse's checks, parser-work charges, lexical refusals and element projection for the stated text size.xmldsig::transforms::xslt::source: the canonical walk runs where octet input is decoded, counts the octets, applies the XML input policy limits (size, nodes, depth, namespace bindings) as the preflight would, and records the constructs on a tape in query storage whose growth is admitted against the workspace; after the stylesheet compiles the tape is replayed into the builder.xslt::executetakes the input as octets or a node-set; the separate canonicalization buffer is gone.RUSTFLAGS; the alloc-only job, which also checksthumbv7emandwasm32, keeps the default linker. The benchmark image links with mold per target.Testing
Tests, clippy, formatting, doctests and the
xsltfeature profile pass locally on macOS with the xmlsec1 oracle; equivalence tests compare the built tree with the parse of the canonical octets over sampled node-sets and at every policy limit. The full workspace builds and links with mold on Linux, and its test results match the default linker's.Closes #375
Summary by CodeRabbit