-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Investigate the issue of Show
bloat
#15548
Comments
One possibility is add a |
cc @huonw |
We could do this via (hypothetical) conditional attributes #[cfg_attr(not(ndebug), deriving(Show))]
struct Foo { ... } or even a more specific version:
(Theoretically we should be bootstrapping/testing with |
I guess we could even have #[cfg(not(ndebug))]
macro_rules! debug_show {
($($it: item)*) => {
$(
#[deriving(Show)] $it
)*
}
}
#[cfg(not(ndebug))]
macro_rules! debug_show {
($($it: item)*) => {
$( $it )*
}
}
debug_show! {
struct Foo { ... }
enum Bar { ... }
} This would be easy to be specific to libsyntax/librustc and doesn't require an external plugin, but is also kinda ugly. |
Any sort of debug-only Any sort of compile-time solution to this problem is very problematic. It involves allowing each client crate to re-derive its own Perhaps the best approach is to expand We could also add a |
Note: I have not actually looked at |
Sure they can, just don't pass On Fri, Jul 11, 2014 at 7:07 PM, Kevin Ballard [email protected]
|
@cmr If I have a no-debug version of Rust on my system (FWIW offhand I don't remember anymore if the default Rust configuration uses |
I don't really see that as a problem. That's how all C and C++ software On Fri, Jul 11, 2014 at 7:24 PM, Kevin Ballard [email protected]
|
@cmr You don't typically have to recompile the language to turn on debugging functionality :P |
You're not recompiling the language; you're just getting debug builds of the libraries you're using (which happen to be the compiler/parser). It's perfectly possible to build only those 2 crates in debugging mode directly, without a full bootstrap. |
I'm currently characterizing the effect of my changes from #15585 on build time and sizes. Let's see what the data says. |
#15585 derives 19 The effect on build time is within the (rather large) variance in build time on my test box (uncertainties are standard deviation over multiple builds),
The effect on the compiler's maximum RSS is negligible,
The instances add roughly 150 kilobytes to the resulting binary size,
|
Is there any way to make the generated formatting code iself simpler? An escaped curly always splits a String formatting piece for logical reasons, so Show for structs begins and ends with double Also would it be beneficial to replace the many FormatSpec struct literals with a reference to a single |
Certainly! The Both of those suggestions sound like excellent improvements. |
@alexcrichton I think this issue can be closed. |
Indeed! |
Blast from the past 🚀 |
Restructure some modules in rust-analyzer crate
In rustc, many types derive
Show
purely for use withdebug!
. This may be negatively impacting compiletime, as we are generating and translating code that we really don't care about most of the time. Is this causing noticable impact, and do we want to do anything about it?The text was updated successfully, but these errors were encountered: