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

Any way to make the compilation/testing faster? #202

Closed
juliohq opened this issue Mar 24, 2023 · 11 comments
Closed

Any way to make the compilation/testing faster? #202

juliohq opened this issue Mar 24, 2023 · 11 comments
Labels
c: tooling CI, automation, tools quality-of-life No new functionality, but improves ergonomics/internals

Comments

@juliohq
Copy link
Contributor

juliohq commented Mar 24, 2023

I'm sorry for opening this issue, I'm not sure if this is the correct way to discuss about this topic.

Right now the compilation process looks a bit slow. Do you think there's any way to speed it up somehow? Maybe avoiding useless recompilation?

@fruitsbat
Copy link

have you already tried using mold as a linker?

it's a pretty safe way to speed up rust compilation but still has some issues on anything that's not linux iirc

@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals c: tooling CI, automation, tools labels Mar 24, 2023
@Bromeon
Copy link
Member

Bromeon commented Mar 24, 2023

Yes, there are several ideas:

Also, once that's all done, we an have a look at the flamegraphs emitted by cargo build --timings to get a more concrete idea of bottlenecks.

Bevy also has some ideas on build optimization, some might be applicable here. In general, one huge advantage that gdext has over other Rust projects is that the legwork is done by an external engine, which is dynamically linked -- so a lot of the problems are moved to the C++ side.

@juliohq
Copy link
Contributor Author

juliohq commented Mar 24, 2023

have you already tried using mold as a linker?

it's a pretty safe way to speed up rust compilation but still has some issues on anything that's not linux iirc

Not actually, but I'm trying it right now and looks to be way faster. And yes, I'm on Linux.

@Bromeon
Copy link
Member

Bromeon commented Mar 24, 2023

@juliohq out of curiosity, where exactly do you experience slowness? During incremental compilation, or just the initial one?

@juliohq
Copy link
Contributor Author

juliohq commented Mar 24, 2023

@juliohq out of curiosity, where exactly do you experience slowness? During incremental compilation, or just the initial one?

During incremental ones and ./check.sh. I have an i3-2120, which is pretty much low-end, but I don't think that should be so slow.

Also, commenting out those lines makes it cargo build 20% faster for a clean build:

[profile.dev.package.bindgen]
debug = 0
opt-level = 3

[profile.dev.package.nanoserde]
debug = 0
opt-level = 3

[profile.dev.package.quote]
debug = 0
opt-level = 3

[profile.dev.package.proc-macro2]
debug = 0
opt-level = 3

[profile.dev.package.venial]
debug = 0
opt-level = 3

[profile.dev.package.godot-codegen]
debug = 0
opt-level = 3

@lilizoey
Copy link
Member

Also, commenting out those lines makes it cargo build 20% faster for a clean build:

do you know what impact it has on incremental build times?

@juliohq
Copy link
Contributor Author

juliohq commented Mar 24, 2023

Also, commenting out those lines makes it cargo build 20% faster for a clean build:

do you know what impact it has on incremental build times?

2m 26s with opt-level = 3, 2m 11s with everything commented out. However I wouldn't take that as absolute, still need to check what the times are under different conditions I guess.

@Bromeon
Copy link
Member

Bromeon commented Mar 24, 2023

Very interesting, thanks for the feedback. Might be worth removing the special handling of those crates. Seems like the faster runtime does not make up for the extra compilation time needed for release mode.

Regarding check.sh, one problem is that the different subtasks may be compiled with slightly different compiler config, which requires needless recompilation. We can probably improve that too.

@Bromeon
Copy link
Member

Bromeon commented Apr 2, 2023

I removed those lines and allow for pre-generated bindgen in #211. There are still more places to optimize, like check.sh, but it might already help somewhat.

@juliohq
Copy link
Contributor Author

juliohq commented Apr 4, 2023

@Bromeon sure, that has helped a lot though!

@Bromeon
Copy link
Member

Bromeon commented Apr 4, 2023

Good to hear! 🙂
I'll close this, we can address future improvements in separate issues.

@Bromeon Bromeon closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: tooling CI, automation, tools quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

No branches or pull requests

4 participants