Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMake `--release` default (at least for dependencies) #784
Comments
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
That's fine for compiler settings. I would optimze package manager settings for package users and not package developers, because |
This comment has been minimized.
This comment has been minimized.
|
The people running In any case, I opened #785 about another way we can reduce this confusion. |
This comment has been minimized.
This comment has been minimized.
|
Yes, i meant for dependencies. Sorry for not being clearer. I've adjusted the title. |
kud1ing
changed the title
Make --release default
Make --release default for dependencies
Oct 31, 2014
kud1ing
changed the title
Make --release default for dependencies
Make `--release` default for dependencies
Oct 31, 2014
This comment has been minimized.
This comment has been minimized.
|
I personally much prefer "give me a result fast" than "give me a fast result" when developing. I feel it tends to lead to better first impressions especially. This would be an interesting option to turn on, however! |
This comment has been minimized.
This comment has been minimized.
|
Optimizing the dependencies would also mean removing their debug symbols, making debugging harder. |
This comment has been minimized.
This comment has been minimized.
|
I have two assumptions:
|
This comment has been minimized.
This comment has been minimized.
|
Another Cargo user tripped over this:
http://www.reddit.com/r/rust/comments/2omtj1/state_of_io_in_rust/ |
This comment has been minimized.
This comment has been minimized.
|
I've created an issue in rust-lang/rfcs for a similar problem with direct rustc usage (rust-lang/rfcs#777). It would be nice to have a message when using non-release builds that optimizations are turned off so that beginners (especially from JIT'ed/interpreted languages) know that "fast code" isn't the purpose of the default build. I think a message is probably enough. A change in default behavior is, I think, unnecessary especially given the compilation time differences. |
This comment has been minimized.
This comment has been minimized.
|
I agree with @kud1ing on this one. Having to endure slow code in the dependencies just because I want to debug my code is rather unfortunate. Just consider how much fun it would be if you also had to build LLVM without optimizations just because you want to an unoptimized build of rustc. For me, building your dependencies without optimizations is often a "last resort" for debugging, when I consider that the dependency itself might be broken. |
tanadeau
referenced this issue
Feb 3, 2015
Closed
rustc should notify users when optimizations are disabled #777
This comment has been minimized.
This comment has been minimized.
|
@tomaka Perhaps the default should be to optimize the dependencies and keep their symbols? Of course debug info won't be as accurate for an optimized dependency, but that's not as important as for one's own code. Personally I don't need more than dependencies' function names in the stack trace, but having them run fast, even in my debug code, would be great. I often write non-performance-sensitive "glue" code around libraries doing heavy lifting, so optimized dependencies would be great for me. |
This comment has been minimized.
This comment has been minimized.
|
Another "Rust is slow" story: http://www.reddit.com/r/rust/comments/2x6652/experiences_migrating_a_go_project_to_rust/ |
kud1ing
changed the title
Make `--release` default for dependencies
Make `--release` default (at least for dependencies)
Feb 26, 2015
This comment has been minimized.
This comment has been minimized.
|
@kud1ing Complaining about the status quo like this is not necessarily good – you can't see if the other option would raise similar problems with users about the even slower compilation speed. |
This comment has been minimized.
This comment has been minimized.
|
@tbu-: To me this issue is a suggestion to fix a problem that people encounter. Can you point out what you'd like to see improved? |
This comment has been minimized.
This comment has been minimized.
|
I want to say that if you introduce a new problem by fixing the "problem that people encounter", then you might generate a new "problem that people encounter". It is known that this is a problem, however that does not mean that the other problem (longer compilation times) isn't a "problem that people encounter", you just don't see that yet, because it's not yet changed. |
This comment has been minimized.
This comment has been minimized.
|
Well that's natural to me. First you identify a problem and agree that it's worthwhile to solve. Then you try a solution and see that the solution is correct or even worth it. I think this proposal right now is between step 1 and 2. |
This comment has been minimized.
This comment has been minimized.
|
Even if it's not made default, I'd appreciate if there was a way to compile the dependencies in release. If I compile the program I'm currently writing in debug mode, it takes ~10 seconds to compile but has a loading screen of around ~20 seconds (loading data is done by dependencies). If I compile it in release mode, it takes ~30 seconds to compile but the loading screen is almost instant. If dependencies were compiled in release mode and the program in debug mode, I would get the best of the two worlds: 10 seconds to compile and an almost-instant loading screen. |
This comment has been minimized.
This comment has been minimized.
|
If you look at Haskell's cabal or Node's npm etc., you'll see that package managers are not only used by developers to build the software they are writing, but it's also a means for users of software to download, compile and install it. People are used to commands like |
This comment has been minimized.
This comment has been minimized.
|
The defaults for the hypothetical |
This comment has been minimized.
This comment has been minimized.
|
I guess a default flag |
This comment has been minimized.
This comment has been minimized.
|
No, it would be for `install`. If you're building yourself, then you need
to understand what the build does.
|
This comment has been minimized.
This comment has been minimized.
|
At least I definitely more often need shorter build times and easier "debugability" when building as 99% of the time I'm building while developing and relying on test and/or typecheck. For |
This comment has been minimized.
This comment has been minimized.
I can't follow. When i am using third party libraries i almost never want to debug them, unless they are really buggy. |
kud1ing
closed this
Feb 26, 2015
This comment has been minimized.
This comment has been minimized.
|
(to be clear, my comment was just about a regular build, not dependencies. I'm not sure how I feel about their setting) |
This comment has been minimized.
This comment has been minimized.
|
I think that one wants the dependencies optimized most of the time. I am not sure about one's own code. Longer build times are a downside. People publishing unoptimized benchmarks suck too. |
This comment has been minimized.
This comment has been minimized.
|
I created #1309 a while ago to log the profile so that at least people can say the've been warned. |
alexcrichton
referenced this issue
Feb 27, 2015
Closed
Add an option to optimize just dependencies #1359
This comment has been minimized.
This comment has been minimized.
I agree with your analysis here. This is a real problem, but I'm not sure that we've settled on quite the right solution just yet. I think that the gist of #1309 that @tanadeau is proposing is quite promising, however.
I very much agree! I have opened #1359 on this topic. |
This comment has been minimized.
This comment has been minimized.
lahwran
commented
Feb 27, 2015
|
I like the idea of cargo reminding me that I built something in debug mode and not fast mode, not just rustc reminding me. It would also be nice for cargo to point out to me that it puts release binaries elsewhere, because even knowing I needed --release to get fast code, my benchmarks were skewed because I was running the debug binary in target/projectname, not the release one in target/release/projectname. It was off by a factor of 10, and was enough slower that I did a major refactor for performance - which did end up doubling speed once optimizations were on, but that's 0.25 sec vs 0.13 sec, so w/e. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@huonw : I submit that this is not a fair analogy. It's fine for |
This comment has been minimized.
This comment has been minimized.
|
Just for reference, people still trip over this: https://www.reddit.com/r/rust/comments/4tikmf/why_is_my_forth_virtual_machine_written_in_rust/ |
This comment has been minimized.
This comment has been minimized.
|
FWIW, people also forget to add |
This comment has been minimized.
This comment has been minimized.
qm3ster
commented
Aug 3, 2018
|
I have a question about |
This comment has been minimized.
This comment has been minimized.
|
@qm3ster ah currently unless you check the crate out manually and modify it you can't |
This comment has been minimized.
This comment has been minimized.
|
If you want to experiment with a nightly unstable feature, you can use config overrides. The easiest way is probably to use an environment variable like this: CARGO_PROFILE_RELEASE_LTO=true cargo +nightly install NAME -Z config-profile |
This comment has been minimized.
This comment has been minimized.
qm3ster
commented
Aug 20, 2018
|
@ehuss Am I correct to understand that |
This comment has been minimized.
This comment has been minimized.
@qm3ster correct. |
kud1ing commentedOct 31, 2014
Is there a reason why building (dependencies) with full optimization is an opt-in?
I can imagine it will lead to many "Rust is slow" complains, as in:
http://www.reddit.com/r/rust/comments/2kp1di/presenting_rustimage_v01/clnihza