-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Performance] Direct rendering to OffscreenCanvas(es) #360
Comments
Have you tried Also, enabling SIMD will result in faster speeds. #148 |
Thank you for the super fast response! 😄 I wasn't aware of that! It is basically what I was thinking of for my bullet 1. I tried it out, and indeed it cut out all the useless png encoding/decoding. const resvgJS = new Resvg(new Uint8Array(m.content), opts);
const pixels = resvgJS.render().pixels;
drawPromises.push(createImageBitmap(new ImageData(new Uint8ClampedArray(pixels), m.width, m.height)).then((bitmap) => {
return {canvases: m.canvases, image: bitmap};
})); (There might be some better way than using Anyways, this gave us a nice performance boost. The SIMD stuff also looks super nice!! I'm not sure we want to take on the burden of compiling this in our build since we aren't a rust project, but if push comes to shove with performance we might do it... Thank you so much. |
Can you just use Where does |
Yes, it took a tiny bit of refactoring but I hadn't committed it yet -- just did now. You can see it here: https://github.com/yomidevs/yomitan/tree/performance-canvas in the latest commit. (The code is a huge mess right now unfortunately, will get it cleaned up soon so we can merge it to master) |
Hi! I'm using resvg-js in wasm in the browser (in a Chrome extension, yomitan).
I use it basically like this:
(Note: we
Promise.all
the decode promises in order to have a very tightdrawImage
loop)Basically, we need to render a large number of SVGs in a limited amount of time budget, which we currently cannot meet, and we are observing the following:
asPng
, and 40% inrender
for resvg, suggesting a potential 2x speedupI could see any of the following resvg-js changes potentially helping:
drawImage
We would prefer it in order of 3, 2, 1. But ease of implementation is probably in order of 1, 2, 3. And 3 is probably a bit too niche (but don't let me stop you if you think it seems good as it's our ideal...).
What do you folks think? Do any of these options seem appropriate / feasible to include in the library?
The text was updated successfully, but these errors were encountered: