-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
builtin arithmetic ops should be inlined when used in a generic function #12279
Comments
Can you provide any concrete numbers, data, statistics, or examples to go along with this assertion? |
Outside of a generic function, |
triage: as far as I can tell, the IR for a generic and specific |
Does not seem to be relevant for Rust 1.3+ - could you provide an example? |
Actually, this is talking about: fn foo<T: Add>(t: T) { t + t }
fn main() { t(4u32); } |
Triage: still produces slower code without |
Triage: Still true. Smaller test program (no I/O or formatting): https://godbolt.org/g/B9t75L |
Current impl is here; is it really just about using inline(always) here? Any drawbacks to that? macro_rules! add_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Add for $t {
type Output = $t;
#[inline]
#[rustc_inherit_overflow_checks]
fn add(self, other: $t) -> $t { self + other }
}
forward_ref_binop! { impl Add, add for $t, $t }
)*)
} |
Performance of compile times and run times was gathered based on #62095 but no measureable difference whether |
…icola Increase defalt chalk overflow depth to match max solver size TBC: - rust-lang#12279: ok above 480 - ~~rust-lang#12182~~ - ~~rust-lang#12095~~ - rust-lang#11902: ok above 350 - ~~rust-lang#11668~~ - rust-lang#11370: ok above 450 - rust-lang#9754: probably ok above 250 (!), and the code in cause and branch are gone Closes rust-lang#12279 Closes rust-lang#11902 Closes rust-lang#11370 Closes rust-lang#9754
Fix: no_effect_underscore_binding fires on ignored parameters of async fns Fixes rust-lang#12279 changelog: Fix [`no_effect_underscore_binding`]) The warning is no longer displayed when an underscore is given in the parameter name of an asynchronous function.
The basic operations on the built-in types compile to inferior code in generic functions without
--opt-level=2
for heuristic-based inlining. The library should define these operations in the same way to avoid a distinction as not inlining them only slows down compile-time and doesn't aid in debugging.The text was updated successfully, but these errors were encountered: