-
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
Inline CStr::from_ptr #90007
Inline CStr::from_ptr #90007
Conversation
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 86c309c has been approved by |
@bors rollup=never |
⌛ Testing commit 86c309c with merge 145b4ae1789429e81b02f00393820ad7d32ab5cc... |
💥 Test timed out |
😕 Either incomplete log or networking issue. https://github.com/rust-lang-ci/rust/runs/3962928502?check_suite_focus=true @bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (514b387): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inline strlen_rt in CStr::from_ptr This enables LLVM to optimize this function as if it was strlen (LLVM knows what it does, and can avoid calling it in certain situations) without having to enable std-aware LTO. This is essentially doing what rust-lang/rust#90007 did, except updated for this function being `const`. Pretty sure it's safe to roll-up, considering last time I did make this change it didn't affect performance (`CStr::from_ptr` isn't really used all that often in Rust code that is checked by rust-perf).
Inlining this function is valuable, as it allows LLVM to apply
strlen
-specific optimizations without having to enable LTO.For instance, the following function:
Looks like this if
CStr::from_ptr
is allowed to be inlined.Note that optimization turned this from O(N) to O(1) in terms of performance, as LLVM knows that it doesn't really need to call
strlen
to determine whether a string is empty or not.