Open yisibl opened 2 years ago
@yisibl I tried changing the build option. There was indeed a slight speedup, but the conversion of Anime_Girl.svg is still significantly slower than resvg-js.
I will publish #44 , but I'm going to keep this issue open and proceed with the research.
Yes, it's actually unfair to compare wasm with a library that generates binaries like resvg-js, wasm itself will have some overhead.
As a wasm library, we can just make a compromise between performance and file size.
The original svg takes forever to render with wasm. Not even possible to get a valid timeline profiling report.
I had to make smaller width/height:
viewBox="0 0 744 1052" height="100" width="142"
Timeline shows major cost in resvg::render::render_node
and resvg::render::render_group
.
For example, this file renders very slowly: https://commons.wikimedia.org/wiki/File:Anime_Girl.svg
Improvements: https://github.com/yisibl/resvg-js/blob/443d1c3de7cf2dc72c87299cb046e57621062654/Cargo.toml#L29-L34 This increases the size of the wasm file, but it improves rendering performance to some extent, and I think it's worth it.
Fundamentally, it may require upstream resvg to optimize.