-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Three.js dev iteration process, bundling has become really slow #30829
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
Comments
What I do is that I just replace the build path by src and then I get realtime dev environment: <script type="importmap">
{
"imports": {
"three": "../src/Three.WebGPU.js",
"three/webgpu": "../src/Three.WebGPU.js",
"three/tsl": "../src/Three.TSL.js",
"three/addons/": "./jsm/",
}
}
</script> |
I understand there are ad-hoc patches that can be made but we should fix the dev process so it's not so misleading, slow, and error prone for non power users. |
Just to make sure we're all seeing similar numbers – npm run build 22.19s user 1.41s system 334% cpu 7.053 total |
Commenting out the minified builds drops the build time to a pretty consistent 2–2.5s, for me, perhaps we could make that the default and only do minification for production builds. Nervous to disable code splitting, since that might hide mistakes when importing from the wrong place. Using source files in local development could be nice but probably means we can't just use a simple static server anymore. |
IMO, these numbers are okay. Especially since the files used in the examples are build first. I'm not sure this justifies a change in the build system... |
I use
|
Here's how long it takes for a build to run for me - similar numbers it looks like:
By comparison I'm getting around 7-8 seconds for a build in r150 so the build times have more than tripled:
I'm not sure how you're concluding this. I'm not convinced that the "files used in the examples are build first" since the "three.core.js" file is used by the import from examples and possibly rebuilt multiple times or something. The current time from change to see the changes in the examples is unacceptable and you don't need to look at numbers to experience that dev has gotten worse. Are you not seeing a significantly degraded dev experience? The fact that users are modifying the example import maps to point to source rather than build to test files is evidence it's not just me. More subjectively here's what the dev experience feels like in the
Compare to
I've already made the mistake of thinking changes I made were present and wasted time testing something only to realize the I was looking at old code multiple times. |
Would using the existing |
Using the "configOnlyModule" flag works better but still takes around 7-9 refreshes before the content is available and the Changing the config so only Is there a reason all the modules files are separated as separate build entries for rollup? |
I might be missing something here, and maybe other maintainers really do rely on the builds during development. But instead of always working with the built files, couldn’t we just update the Rollup config to alias all imports from |
builds[1] takes 1.5 seconds for me, and it sounds like our CPUs are similar — are we measuring the same thing? Note that only the last number of I'm not opposed to using source files in local development, just want to make sure there's not some more fundamental disconnect like having "Disable cache" off in devtools. 🙂 |
I would be fine with this workflow personally. If there wind up being issues with code splitting it would (hopefully?) be caught in CI.
My machine measures 2.6s for If we want to look at raw numbers we should consider the values that rollup logs when it's watching files and rebuilding on change. In r150 it takes half a second to finish a build of the relevant file on change for me:
And in dev it takes over 1.5 seconds to finish even when running just
I am confident. |
Time taken by builds creation varies from device to device and depends on modifications made, developers soon or later suffer the same degraded experience even if the measured numbers maybe decent right now. To me, tailoring bundles is not in right direction. A reliable approach is that let developers retrieve the sources per se in browser, in turns refreshing page must reflect latest changes of them. Since it bypassed build creations, the time taken is now network-bound, not a big deal as server is serving on loopback, measured numbers would be similar between devices, and modifications made won't affect much; It does take longer on parsing scripts due to no minification, but it's negligible. |
To be clear I have no issue with a build step - it's possible for it to be fast on even extremely large projects. Other more modern build processes like vite cache and keep files split so only a limited number of files need to be transformed on change for development specifically. They also block reload until the bundle has finished if it does take time to avoid accidentally looking at "stale" changes and related mistakes. That said I don't want to recommend overhauling and overcomplicating the build process for the repo. The simple changes suggested in #30865 seem good enough for me and address everything raised in this issue if everyone else is comfortable. |
Thank you for the update, you want a deterministic environment that either renders the latest changes or render nothing if building is underway, and time-to-wait is not the most concern. In this case I prefer modern build process approach, it creates real build files so developers unlikely get into problems caused by unidentical builds (dev vs prod) |
Description
I'm not exactly sure when it happened but modifying three.js core and checking the changes in the example files has become really difficult. The changes used to be reflected almost immediately but now it takes several seconds for anything to change resulting in a lack of trust around whether the latest changes are being displayed. And even then once the page does change it initially logs an error that a subfile is not yet available (because it's still being built):
I suspect this is because with WebGPU and TSL there have become 6 build targets that are also built even if not needed during dev.
Solution
Alternatives
Additional context
No response
The text was updated successfully, but these errors were encountered: