Mark const ptr methods and free functions as inline(always) to match *mut - #160816
Mark const ptr methods and free functions as inline(always) to match *mut#160816zakrad wants to merge 1 commit into
Conversation
|
r? @nia-e rustbot has assigned @nia-e. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
this should probably also cover @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
5b7cb48 to
3206bcf
Compare
Thanks! Added |
|
I did a thorough check and there's a fair few other places (though these should also be quite trivial):
once these are all |
Many <*const T> methods (read family, copy_to{,_nonoverlapping}, offset_from,
len, as_ptr, get_unchecked), the ptr::{read,write,replace,swap,...} free
functions, and the PartialEq/PartialOrd impls were left as inline while their
<*mut T> equivalents are inline(always). This left them with out-of-line calls
in debug codegen; make them consistent.
3206bcf to
1b7548a
Compare
|
@bors r+ rollup |
|
Thanks for the help, I actually spotted a few of these and was planning for a follow up, but since you listed them all here it is. |
…60809, r=nia-e Mark const ptr methods and free functions as inline(always) to match *mut Closes rust-lang#160809. The `*const` read/read_volatile/read_unaligned methods were `#[inline]` while the `*mut` equivalents are `#[inline(always)]` and verified the `*const` forms now inline in debug instead of emitting an out of line call.
Rollup of 7 pull requests Successful merges: - #160533 (dirfd dir operations (3/4)) - #160675 (bootstrap: Remove `PATH_REMAP` from command-line selector handling ) - #160807 (Update rustc crate rkyv to 0.8.18) - #160560 (Add nightly-only support for Cargo unremap trim-paths files in `rust-gdb`) - #160804 (Change .expect message on net/parser to follow precondition style) - #160805 (`extern "custom"`: add tests) - #160816 (Mark const ptr methods and free functions as inline(always) to match *mut)
…60809, r=nia-e Mark const ptr methods and free functions as inline(always) to match *mut Closes rust-lang#160809. The `*const` read/read_volatile/read_unaligned methods were `#[inline]` while the `*mut` equivalents are `#[inline(always)]` and verified the `*const` forms now inline in debug instead of emitting an out of line call.
|
This PR is likely perf sensitive because of the attribute changes and is not a good candidate for adding to a roll-up. I would have marked it iffy and perfed it before merge. But given the recent queue slowness I won't r- it, someone can just perf it after merge. The always variant of the inline attribute is much less of a hint, and it tends to produce the desired inlining even in unoptimized builds and it changes unoptimized monomorphization to do this. I think it should be used very delicately in libraries. |
|
I'm happy to do a perf run, but the benchmarks in question were mostly run already in #85218 so I didn't see the case for marking this as perf-sensitive independent of that - I'd be surprised if it's not just more of the same. if it's useful: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Mark const ptr methods and free functions as inline(always) to match *mut
Rollup of 11 pull requests Successful merges: - #160675 (bootstrap: Remove `PATH_REMAP` from command-line selector handling ) - #160807 (Update rustc crate rkyv to 0.8.18) - #159690 (Clarify `--remap-path-scope` impact on `rustc` metadata) - #160560 (Add nightly-only support for Cargo unremap trim-paths files in `rust-gdb`) - #160608 (normalization rework: clean up projection_ty_core) - #160785 (Get rid of LLM disclosure checkboxes) - #160804 (Change .expect message on net/parser to follow precondition style) - #160805 (`extern "custom"`: add tests) - #160816 (Mark const ptr methods and free functions as inline(always) to match *mut) - #160820 (Stabilize fs_set_times) - #160826 (Rename parse_delimited_token_tree in cfg_select)
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0f1a713): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.6%, secondary 0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.4%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 458.441s -> 464.25s (1.27%) |
|
yeah, this reads as noise to me. I'm not sure if there's much to read into here ^^ |
Closes #160809. The
*constread/read_volatile/read_unaligned methods were#[inline]while the*mutequivalents are#[inline(always)]and verified the*constforms now inline in debug instead of emitting an out of line call.