Repository navigation
perf(c14n): reuse the namespace declaration list - #392
Conversation
- The canonical output owns a declaration buffer beside the attribute buffer; the namespace renderer fills it for each start tag, and it is emptied before the next one. Exclusive C14N, which redeclares a prefix on every element that uses it below a non-utilizing ancestor, no longer allocates a list per such element. - Attribute collection moves out of serialize_start_tag into its own function; output is byte-identical in every mode. - An allocation-counting test pins the allocations of a whole canonicalization to the same count for 16 and 256 elements in every mode, so a per-tag declaration or attribute list fails it. Closes #391
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. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Summary
Changes
NsRenderer::render_namespacesandcollect_ns_declarationsfill a caller-owned, empty declaration list and return only the rendered map.serialize_start_tagintocollect_start_tag_attributes; output is byte-identical.tests/c14n_allocations.rscounts allocations with a global allocator and requires the same count for 16 and 256 elements in every mode, with and without comments.Testing
Library unit tests, the C14N golden and integration suites, the new allocation test, clippy with all features and formatting pass on macOS. The allocation test fails against a per-tag declaration list (Exclusive) and against a per-tag attribute list (Inclusive).
Closes #391
Summary by CodeRabbit