you are doing an allocation (calling .to_vec()) which is not necessary here since you iterate over it again so why you make a separate copy of every frame on that hot loop?
yep, that's definitely a redundant allocation!
However, based on the performance I measured, I found the major overhead exists in JsValue::from_serde(&gif).unwrap() where this process took up to 90% execution time of the whole function.
Thanks anyway!
BTW, I am wondering if there is a way to pass an object reference to wasm runtime or can wasm return a stream object?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
something I noticed when I opened the repo, here github.com/WenheLI/wasm-gif/blob/6...
you are doing an allocation (calling .to_vec()) which is not necessary here since you iterate over it again so why you make a separate copy of every frame on that hot loop?
yep, that's definitely a redundant allocation!
However, based on the performance I measured, I found the major overhead exists in
JsValue::from_serde(&gif).unwrap()
where this process took up to 90% execution time of the whole function.Thanks anyway!
BTW, I am wondering if there is a way to pass an object reference to wasm runtime or can wasm return a stream object?