This seems worth a bugreport in the rust-lang/rust repo. We’ve changed the #[inline] on Debug in the past and we can change it again. It’s just hard to pick a good trade-off between code size, compile time, and run time.
It’s just hard to pick a good trade-off between code size, compile time, and run time.
I wonder what a stable (or semi stable) interface for a higher level hint could be. I’m thinking metadata in Cargo.toml. One thought could be an ability to cap the final binary size and have the compiler try to deopt if that’s hit (for example). But that might be too exact. Too brittle.
Thankfully this specific thing could also be pushed to a crate. So we could have a cold::Debug and a inline::Debug etc. or have it configurable with a container attribute.
(I didn’t raise it originally because, having done other compiler work, I’m very sympathetic to the notion that there’s no perfect default or heuristic Rust can pick here :-))
(I didn’t raise it originally because, having done other compiler work, I’m very sympathetic to the notion that there’s no perfect default or heuristic Rust can pick here :-))
Very true. A single report of “the heuristics are bad here” may not be very actionable. But it’s still valuable to have a place to collect them; if we get multiple such reports that may indicate a need to rebalance things a little.
This seems worth a bugreport in the rust-lang/rust repo. We’ve changed the
#[inline]onDebugin the past and we can change it again. It’s just hard to pick a good trade-off between code size, compile time, and run time.score 1 · canonical
I wonder what a stable (or semi stable) interface for a higher level hint could be. I’m thinking metadata in Cargo.toml. One thought could be an ability to cap the final binary size and have the compiler try to deopt if that’s hit (for example). But that might be too exact. Too brittle.
Thankfully this specific thing could also be pushed to a crate. So we could have a cold::Debug and a inline::Debug etc. or have it configurable with a container attribute.
score 2 · canonical
Yeah, I’ll definitely raise it this week. Thanks!
(I didn’t raise it originally because, having done other compiler work, I’m very sympathetic to the notion that there’s no perfect default or heuristic Rust can pick here :-))
score 1 · canonical
Very true. A single report of “the heuristics are bad here” may not be very actionable. But it’s still valuable to have a place to collect them; if we get multiple such reports that may indicate a need to rebalance things a little.
score 1 · canonical