KnicKnic / WASM-ImageMagick

Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-thread support

thibaultmol opened this issue · comments

So on linux we can use some tricks to use imagemagick in parallel. But on the WASM we're limited to the command line options box.

I know it's probably a lot of work to make it work, but for large image sets, it would be nice if it utilized all my cores (definitively now that processors with large amounts of cores are getting more popular (Ryzen))

https://developers.google.com/web/updates/2018/10/wasm-threads

For large files you will hit sandbox ram limit sizes. For large number of files, you can always spin up multiple web workers, but due to ram usage per worker I am not sure this would be the best idea.

See https://github.com/KnicKnic/WASM-ImageMagick/blob/master/src/magickApi.ts on how the worker is used.

Edit
I thought spectre largely set back sharedbufferarray (and therefore threads). Looking at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer It is only available in one broswer by default no mobile browsers. If it becomes more popular feel free to reopen.