Build dependencies with opt-level 3 always#1975
Conversation
| path = "src/main.rs" | ||
|
|
||
| [profile.dev.package."*"] | ||
| opt-level = 3 |
There was a problem hiding this comment.
Wouldn't this slow down the dev build?
There was a problem hiding this comment.
Speaking for myself, but I always build with --release. I think that dev builds (with the default opt-level 0, at least) are just too slow, especially with the reports of segfaulting with dev binaries because maybe calls don't get inlined or something.
There was a problem hiding this comment.
Though maybe opt-level 2 would be better for debug builds, since 3 makes there no difference between debug/release
There was a problem hiding this comment.
Yes, it will slow building dependencies (which rarely build again) but boost running speed.
For the building speed, dependencies are usually the same and we only rebuild rustpython part. So only the first build will be slowed down but we will always get the benefits of running speed.
Because we usually only need to debug RustPython part, I think this will only cause speedup of running speed of dependencies and (mostly) nothing to lose (Though this option must be edited when we also need to debug dependencies - which is not very ideal)
I don't see any reason not to use the same option for debug/release build. They are not the part of RustPython so they must be blackbox for usual use case. So using same option is actually better because users anyway will use them only with release build. But it is considerable If build speed of opt-level 2 is a lot better than 3.
There was a problem hiding this comment.
Yeah, maybe we could benchmark it somehow -- like touch */src/lib.rs && cargo build, and see how big the difference is.
|
It's about a 2.25 minute difference with a clean build; 5 minutes 30 seconds opt-level 2 vs 7 minutes 45 seconds opt-level 3. It's basically the same time for both running |
3dacedb to
9cf1c5c
Compare
palaviv
left a comment
There was a problem hiding this comment.
Sounds good. I agree we rarely rebuild the dependencies.
9bc9d7a to
78e60f2
Compare
78e60f2 to
8bee620
Compare
|
I checked CI runtime for debug build and it is even faster than before We will lose time for first build for cache but gain time for cached running. It looks like good deal now regardless of opt2. @coolreader18 how do you think now? |
|
LGTM 😁 |
6ee1998 to
7629a2d
Compare
|
I changed workflow a bit. wasm build now run after rust_tests to reuse cache from it and python lint is merged to rustfmt and clippy job. |



https://doc.rust-lang.org/cargo/reference/profiles.html#overrides