Skip to content

faster SVG rendering - #63

Merged
matmen merged 1 commit into
masterfrom
faster-svg
Oct 16, 2026
Merged

matmen merged 1 commit into
masterfrom
faster-svg

Conversation

@matmen

@matmen matmen commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Faster SVG rendering: layers remember the rectangle they painted. Compositing a layer (groups with opacity, clip paths, masks, nested viewports) and converting the canvas to RGBA only walk that rectangle, instead of checking every transparent pixel of the image one by one.

Identical results: the 1822 SVGs of the resvg test suite, rendered 300 and 1000 pixels wide, checked against master (3644 renders, 0 different).

Speed: rendering tests/svgs/features.svg 1920 pixels wide takes about 20% less time.

@matmen matmen added this to the v3.2.0 milestone Oct 16, 2026
@matmen matmen self-assigned this Oct 16, 2026
@matmen matmen added the enhancement New feature or request label Oct 16, 2026
Layers remember the rectangle they painted. Compositing a layer (groups with opacity, clip paths, masks, nested
viewports) and converting the canvas to RGBA only walk that rectangle instead of every pixel of the image:
everything outside it is transparent and was skipped pixel by pixel before.

The results are bit-identical: the 1822 SVGs of the resvg test suite checked against master at 300 and 1000
pixels wide. tests/svgs/features.svg at 1920 pixels wide renders 15-20% faster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
@matmen
matmen merged commit 6e1e182 into master Oct 16, 2026
13 checks passed
@matmen
matmen deleted the faster-svg branch October 16, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant