Skip to content
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

Very long build times (1min+), need speedups #3575

Closed
Maksims opened this issue Oct 13, 2021 · 11 comments
Closed

Very long build times (1min+), need speedups #3575

Maksims opened this issue Oct 13, 2021 · 11 comments
Assignees
Labels
performance Relating to load times or frame rate

Comments

@Maksims
Copy link
Collaborator

Maksims commented Oct 13, 2021

Currently, the engine takes a very long to build.
npm run build, on a good laptop (4 years old top gaming laptop), takes 1 minute and 16 seconds. And about 20 seconds for playcanvas.js file build.
Would be great if there would be a developer-focused build target (with watch variant), that would be built within few seconds (as fast as possible), that does not need many validations, etc, but needs for a quick test during the development process.

Previously builds were way faster than now.

@mvaligursky
Copy link
Contributor

we have these target builds at the moment:

    case "es5":      targets = [target_release_es5,    target_extras]; break;
    case "es5min":   targets = [target_release_es5min, target_extras]; break;
    case "es6":      targets = [target_release_es6,    target_extras]; break;
    case "debug":    targets = [target_debug,          target_extras]; break;
    case "profiler": targets = [target_profiler,       target_extras]; break;

often I either use npm run build:es5 or npm run build:debug

@Maksims
Copy link
Collaborator Author

Maksims commented Oct 13, 2021

npm run build:es5 takes around 20 seconds, which is still very slow for testing during the development.

@mvaligursky
Copy link
Contributor

On my laptop they're 14s each .. but agree if there's a way to speed it up, I'd like it.

@belohlavek
Copy link

What's the bottleneck? Have you considered esbuild?

@mvaligursky
Copy link
Contributor

see a relevant ticket here #2103

@willeastcott
Copy link
Contributor

@belohlavek The bottleneck (or main contributor to the build time) is Babel. If you disable Babel in the rollup.config.js, build time drops by about 65%.

@Maksims
Copy link
Collaborator Author

Maksims commented Dec 27, 2021

@belohlavek The bottleneck (or main contributor to the build time) is Babel. If you disable Babel in the rollup.config.js, build time drops by about 65%.

Probably worth investigating for a very fast build option, for development purposes, with a watcher, that allows the developer to iterate quickly on the engine.

@willeastcott
Copy link
Contributor

willeastcott commented Dec 30, 2021

This PR allows you to load the engine from source without having to build it: #3850

Maybe not useful for Editor users at the moment, but maybe interesting for engine devs or anybody running the engine in Node.

@willeastcott willeastcott self-assigned this Dec 30, 2021
@willeastcott willeastcott added the performance Relating to load times or frame rate label Dec 30, 2021
@willeastcott
Copy link
Contributor

I have researched ways to get Babel to execute faster and it doesn't seem there is anything further we can do at this time. So since this isn't really a PlayCanvas issue, I'm going to close this. However, I'm still very interested in anyone's ideas to improve this. So if you think I've missed some practical thing we can be doing to achieve better build times, let me know and I can re-open the issue.

@yaustar
Copy link
Collaborator

yaustar commented Jan 3, 2022

Could we have a no babel build option for dev purposes? (Eg running against the Editor)

@willeastcott
Copy link
Contributor

Yes, we could do that. But I just tried npm run watch:es5 and it takes 2.9 seconds to rebuild playcanvas.js instead of 13.8s for npm run build:es5.

image

As a result, I think we can just leave this closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Relating to load times or frame rate
Projects
None yet
Development

No branches or pull requests

5 participants