-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
ThreeJs ThreeMF loader is blocking the UI while upzipping the 3MF file. #20206
Comments
Even when doing this task asynchronously, it's still done in the main thread and thus blocking the UI. |
Depends on how JSZip is written, but I assume it releases the main thread after every chunck making the UI responsive. Explained here. |
Can you please prove your assumption with a concrete live example? Notice that the upgrade of JSZip was tried several times. It was not possible to finish it because it's necessary to retain the sync usage of |
Thanks for the reference! Tentone clearly had the same idea as me. But indeed I don't think we will be able to keep the sync behavior of the loader.parse() external API. To fix it I would suggest to extend the external API with a parseAsync() function. The original parse function of the threeMf loader will still need to use a sync unzip function. I don't know if JSZip 3 still has this behavior? I will get started creating a live example proving the performance benefit. |
When I remember correctly, it was removed. Hence it suggested to look for a different library which provides a sync method. |
I came to the conclusion that loading the zip file indead blocks the thread for a couple of milliseconds jsfiddle. But opening the 3mf file takes very little time compared to the total 3mf loading time. If the loader would be async it could do all the small actions in the js event queue. This would update the UI in between every small parsing action. (js event queue explained) |
Might be a good candidate for #19650? We could keep JSZip but move it to a worker. |
After a closer performance analysis of So similar to |
Description of the problem
ThreeJs ThreeMF loader is blocking the UI while upzipping the 3MF file.
According the the JSZip documenation I assume it would be better to unzip the container asynchronously not to block the UI.
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: