Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

put createImageBitmap() processing on the worker threads #248

Open
sabercoy opened this issue Dec 23, 2024 · 0 comments
Open

put createImageBitmap() processing on the worker threads #248

sabercoy opened this issue Dec 23, 2024 · 0 comments

Comments

@sabercoy
Copy link

I have seen this mentioned a few times on here: people being concerned with the main thread being blocked before the workers execute. This is true.
image
That big green bar is all of the calls to createImageBitmap() which then the results are passed to the workers which then, in parallel, resize the images.

The ultimate goal here, which I have seen by no library, is to do that work on the worker as well.

createImageBitmap() is asynchronous, but that does not mean it runs in parallel with the main thread. Once it is on the call stack: it hogs the call stack. Your page is frozen.

https://stackoverflow.com/questions/60439279/createimagebitmap-on-main-thread

I suggest, in the case of a File upload, a user can call readAsArrayBuffer() and be able to pass the ArrayBuffer (a Transferable Object) to the worker, where it is then processed as an image.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant