svg2png-wasm icon indicating copy to clipboard operation
svg2png-wasm copied to clipboard

Improve rendering performance

Open yisibl opened this issue 2 years ago • 3 comments

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.

yisibl avatar Nov 02 '21 12:11 yisibl

@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.

ssssota avatar Nov 05 '21 04:11 ssssota

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.

yisibl avatar Nov 05 '21 05:11 yisibl

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.

timeline

timeline.tar.gz

OpenGG avatar Jan 04 '22 14:01 OpenGG