Visitar URL original
Build dependencies with opt-level 3 always by youknowone · Pull Request #1975 · RustPython/RustPython · GitHub
The Wayback Machine - https://web.archive.org/web/20260604082502/https://github.com/RustPython/RustPython/pull/1975
Skip to content

Build dependencies with opt-level 3 always#1975

Merged
youknowone merged 3 commits into
masterfrom
dev-opt-level
Jul 19, 2020
Merged

Build dependencies with opt-level 3 always#1975
youknowone merged 3 commits into
masterfrom
dev-opt-level

Conversation

@youknowone
Copy link
Copy Markdown
Member

Comment thread Cargo.toml
path = "src/main.rs"

[profile.dev.package."*"]
opt-level = 3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this slow down the dev build?

Copy link
Copy Markdown
Member

@coolreader18 coolreader18 Jul 4, 2020 •

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though maybe opt-level 2 would be better for debug builds, since 3 makes there no difference between debug/release

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe we could benchmark it somehow -- like touch */src/lib.rs && cargo build, and see how big the difference is.

@coolreader18
Copy link
Copy Markdown
Member

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 touch */src/lib.rs && cargo build (1 minute), but I think that might be because it knows it hasn't really changed at all.

Copy link
Copy Markdown
Contributor

@palaviv palaviv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I agree we rarely rebuild the dependencies.

@youknowone youknowone force-pushed the dev-opt-level branch 2 times, most recently from 9bc9d7a to 78e60f2 Compare July 18, 2020 18:26
@youknowone
Copy link
Copy Markdown
Member Author

I checked CI runtime for debug build and it is even faster than before
image

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?

@coolreader18
Copy link
Copy Markdown
Member

LGTM 😁

@youknowone youknowone merged commit 5d1b821 into master Jul 19, 2020
@youknowone youknowone deleted the dev-opt-level branch July 19, 2020 15:33
@youknowone
Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants