Skip to content

perf: hand over per-page SVG bytes without copying - #55

Merged
evolvedlight merged 1 commit into
evolvedlight:developfrom
swisspost:perf/svg-page-copy
Oct 17, 2026
Merged

evolvedlight merged 1 commit into
evolvedlight:developfrom
swisspost:perf/svg-page-copy

Conversation

@msallin

@msallin msallin commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Per-page SVG export copied each page's markup into a new Vec with svg.as_bytes().to_vec(). typst_svg::svg already returns an owned String, so its bytes are now moved into the buffer with into_bytes(), the way the merged-SVG path already does. That is one allocation and one copy fewer per page.

Behaviour is unchanged and the existing plain_svg_still_produces_one_image_per_page test covers this path. cargo test --release passes.

typst_svg::svg returns an owned String, so its bytes can be moved into the
output buffer instead of copied, matching the merged-SVG path.
@msallin
msallin force-pushed the perf/svg-page-copy branch from dcee164 to 26d20b8 Compare October 17, 2026 09:10
@evolvedlight
evolvedlight merged commit dfcd044 into evolvedlight:develop Oct 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants