Repository navigation
Use filtra for rendering filter layers - #1255
Conversation
bbb5692 to
73a626e
Compare
|
Here a summary of the updated tests:
|
73a626e to
b75a52d
Compare
|
@LaurenzV The increase in size for the non-WASM builds seems to come primarily from the (in general, perhaps you should do a pass on wasm-without-simd perf/size?) I'm conflicted on how much emphasis to put on wasm-without-simd builds. On the one hand, there seems to be no little reason not to use simd on WASM in 2026. On the other hand, you have to opt-in with a cargo config / rustflag. So default builds won't have it enabled... |
|
Sure, I can take another closer look at WASM itself! |
|
Timings I'm seeing. Run on
|
|
@nicoburns binary size should be back to normal now, and performance should also be better for that build mode now.
|
nicoburns
left a comment
There was a problem hiding this comment.
Much better. The size increase is still a bit unfortunate, but it's a lot more reasonable now.
The fearless_simd changes also seems to have significantly sped up filter runtime of the WASM (no simd) builds (Oz). They're now consistently much faster than the old filters whereas previously some of them were regressions.


Fixes #1185, fixes #1258, fixes #1153, fixes #1150, fixes #840, fixes #1152, fixes #1094.
Context
This PR proposes to move filter rendering in resvg to filtra, a crate I’ve been working on recently. The main motivation for this is that there is interest from other people to have direct SVG filter rendering capabilities, so moving that functionality to a separate crate allows us to reuse this logic. In particular, as can be seen in the numbers below, the crate is much much faster than resvg’s existing logic, and it also solves a number of currently open issues.
usvg now also stores filters using the types from
filtra_typesinstead of its own, so the parsed filters can be passed to filtra directly. This is a breaking change to usvg's filter API:usvg::filter::Filternow dereferences tofiltra_types::Filter<Group>, and usvg's own primitive types are gone (filtra_typesis re-exported from usvg). filtra requires Rust 1.89, so the MSRV of usvg, resvg and the C API is raised from 1.85 to 1.89.The only concern right now is binary size, which increases a bit, but honestly I don't think it's too bad given the speed boost we get.
simd128Benchmarks
As you can see, filter rendering is significantly faster now! Some images are still slow, but those are mostly due to tiny-skia being slow. The filter speedups themselves are huge.
macOS (Apple M1 Pro)
Windows (Intel Core i9-14900K)