Message about release build

Right now after "cargo build", we see something like

Finished dev [unoptimized + debuginfo] target(s) in 0.00s

I heard on a podcast that many people don't understand that there is a release flag. For instance, see Why my rust program is so slow? - help - The Rust Programming Language Forum.

I recommend one additional line of input. The two lines might be:

Finished dev [unoptimized + debuginfo] target(s) in 0.00s

To compile in optimized mode, use --release. See URL.
7 Likes

I think this would be valuable. The problem keeps coming up.

The extra instructions could automatically disappear the first time you use --release flag (i.e. cargo would write some hidden config "dont_show_optimization_hints = true").

I'd be wary of this, considering that a program might use --release without the user's knowing about it.

3 Likes

Cargo already detects tty to decide whether to use color output. Maybe the hint flag could be updated only in tty.

On the other hand, people generally don't read the command output. (They should, but let's admit the reality.) I worry "show only first time" is basically equivalent to "show never", since people won't see the hint when it was printed first time.

If this is implemented, I think it should require manual action, like prompting the user to type cargo seen release-hint, and always print the hint until it is done. Note that Rust's own build system, rustbuild, uses the same strategy, see changelog-seen.

11 Likes

I think that's an edge not worth worrying about. It's still better than not implementing this at all.

Oh, I agree that this warning/suggestion sounds useful to implement.

This is very true, but that's not an excuse not to provide better output. We'd be helping at least some people. It is also useful when people go to users., paste the output and are pointed out that the answer is right there: it tends to stick with people and read the output more carefully from then on :slight_smile:

8 Likes

I'm skeptical that folks who miss the unoptimized word in the current output will magically start reading once we tack on an additional sentence. As a more experienced user, I'd rather not see two extra lines of output that are useless to me.

4 Likes