-
Notifications
You must be signed in to change notification settings - Fork 1.6k
rustc should notify users when optimizations are disabled #777
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
Comments
This might be better suited as a Cargo feature, which has text that appears when compiling. |
@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. |
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. |
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. |
I would prefer if this was a cargo feature, that way it would only warn once rather than for every single invocation of rustc. |
If the user explicitly passes The idea is that you either know what you're doing, or rustc makes sure that you do. |
@Valloric Yes. That's exactly the idea I was going for. |
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 |
@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. |
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). |
Closing in favor of rust-lang/cargo#6152. |
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.rs
will 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:
The text was updated successfully, but these errors were encountered: