-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
LDrawLoader: parallelize parts library downloads to improve load times #22253
Conversation
I think it makes sense to use these when requiring a "this" pointer 👍 |
# Conflicts: # examples/jsm/loaders/LDrawLoader.js
Okay I changed a couple of the arrow functions to classic style where |
Thanks! |
Merge #22249 first
Description
This PR focuses on parallelizing file downloads when loading models from the LDraw Parts Library. There's a lot of rearranging that happened so the diff looks pretty large. The big changes are:
processObject
have been removed because promises simplify things.finalizeObject
has been changed to take the parseScope to finalize and moved to be a class function so the parent scope can guarantee the objects are processed in the right order to avoid messing up the construction steps.With this change loading the Imperial Star Destroyer Lego model goes from a load time of a little over 4 minutes down to around 1 minute 25 seconds. I think there is still room for improvement to be had by caching the parsed file contents rather than parsing the text content over and over every time a file is reused (which might be one of my upcoming PRs 😁).
@mrdoob This PR adds a few arrow functions to the class -- I'm not sure what you're feelings are on using them in the project but generally I find them to be easier to look at and simplify things when working with an outer "this" pointer. If you'd like me to remove them let me know.
For testing you can check out the live link to the ldraw example here (which still is just using the prepacked models).
cc @yomboprime