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 uprustc should notify users when optimizations are disabled #777
Comments
This comment has been minimized.
This comment has been minimized.
sinistersnare
commented
Feb 2, 2015
|
This might be better suited as a Cargo feature, which has text that appears when compiling. |
This comment has been minimized.
This comment has been minimized.
|
@sinistersnare I think it should probably be in both rustc and Cargo, now that you mentioned it. Many beginners are probably not going to use Cargo for their first little hello world-type tests apps, even though they probably should. I know I didn't, especially since the source tarballs with script installers and package managers like Homebrew don't yet include it. |
tanadeau
referenced this issue
Feb 2, 2015
Closed
Make `--release` default (at least for dependencies) #784
This comment has been minimized.
This comment has been minimized.
Valloric
commented
Feb 2, 2015
|
This would be a good idea. Newbies not compiling with optimizations and then complaining about perf issues is a perennial problem with C++ and it's becoming an issue with Rust as well. Just nip this in the bud with a note. |
This comment has been minimized.
This comment has been minimized.
|
OTOH, it seems like it would be annoying for everyone who's not a newbie to be reminded that they don't have optimizations enabled every time they build. |
This comment has been minimized.
This comment has been minimized.
reem
commented
Feb 3, 2015
|
I would prefer if this was a cargo feature, that way it would only warn once rather than for every single invocation of rustc. |
This comment has been minimized.
This comment has been minimized.
Valloric
commented
Feb 3, 2015
If the user explicitly passes The idea is that you either know what you're doing, or rustc makes sure that you do. |
This comment has been minimized.
This comment has been minimized.
|
@Valloric Yes. That's exactly the idea I was going for. |
This comment has been minimized.
This comment has been minimized.
Valloric
commented
Feb 3, 2015
|
Now that I think about it, I think this issue is going about the problem the wrong way. IMO the real solution would be to make rustc compile with optimizations by default, and the user must pass |
This comment has been minimized.
This comment has been minimized.
|
@Valloric I did think of that, but I didn't include that in the issue since there seems to be some strong resistance to "optimize by default" at least within Cargo. See rust-lang/cargo#784 for a somewhat similar discussion there. Turning on optimization by default would definitely be my preference. |
This comment has been minimized.
This comment has been minimized.
|
I should also note that I would be okay (although not enthusiastic) about having this just be a Cargo feature if all of the docs pointed people towards Cargo, which is definitely not the case now. The hello world in the Rust book has people use rustc (http://doc.rust-lang.org/book/hello-world.html). |
petrochenkov
added
T-compiler
T-doc
T-cargo
labels
Jan 28, 2018
Centril
referenced this issue
Oct 7, 2018
Closed
cargo/rustc should notify users when optimizations are disabled #6152
This comment has been minimized.
This comment has been minimized.
|
Closing in favor of rust-lang/cargo#6152. |
tanadeau commentedFeb 2, 2015
As the Rust community gets more developers coming from JIT'ed or interpreted languages like Java, Python, Ruby, etc., we are going to see more problems where they assume
rustc my_file.rswill give fast results even though optimizations are off by default. This can be seen in several threads on Stack Overflow and other forums, including Rust's own (http://users.rust-lang.org/t/reading-numbers-from-a-file/171).I suggest that when no optimization flags are enabled, rustc should print out a message similar to the following: