Use Transferable objects to pass data between worker and page
cancerberoSgx opened this issue · comments
It seens that webworkers support transference of data betwee the worker and the page with a zero-copy operation, which results in a vast performance improvement when sending large data sets. We should use that to pass input and output files from and to the web-worker:
see call boundries
WASM-ImageMagick/src/magickApi.ts
Lines 59 to 70 in 9226e7c
Lines 92 to 96 in 9226e7c
Lines 101 to 104 in 9226e7c
WASM-ImageMagick/src/magickApi.ts
Lines 139 to 150 in 9226e7c
fixed
Hey @KnicKnic - did it improve performance ? (sorry to be just a spectator lately - promise will resume my work in the short term here since I have a couple of features in my branch and will need to use the library). Thanks!
@cancerberoSgx perf not really(copying a gig of ram doesn't use that much cpu(theoretically the max it could have saved in copying before would have only been .33GB saved twice(coming and going) for a total of .66GB) ). If I remember correctly there were scenarios with many files that it helped reduce the ram usage to such a point where it wouldn't exhaust the 1GB limit in chrome.