Mark NonNull read family and offset_from as inline(always) - #161004
Mark NonNull read family and offset_from as inline(always)#161004zakrad wants to merge 1 commit into
Conversation
read, read_volatile, read_unaligned, and offset_from are the only NonNull pointer methods still marked inline; the other 17 are inline(always), as are the raw const/mut pointer equivalents. They are one-line delegating wrappers, so make them consistent -- they now inline in debug like their siblings.
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Do you have any particular evidence this helps? I figure it probably does, but I could be wrong. |
The raw pointer funcs these wrap are #[inline(always)] #160816 NonNull read + offset_from left out, codegen wise the difference shows in debug, at -Copt-level=0 #[inline] stays an out of line call, while #[inline(always)] gets inlined, its not a release perf change but consistency plus tiny unoptimized codegen |
|
Right, I know what |
|
No evidence it does, it was mostly for consistency, we can have perf run tho |
These are one line wrappers that just forward to the raw pointer funcs that are all
#[inline(always)], as are NonNull's ownwriteandoffset, Thereadandoffset_fromwere left as plain#[inline]