4 ms·
> Maybe I misunderstood what the parent wants, but you're right that the optimizer can do as it pleases, and you can use annotations to help it make the right d
by masklinn 12y ago
> Maybe I misunderstood what the parent wants, but you're right that the optimizer can do as it pleases, and you can use annotations to help it make the right decision.
I understand TFAA's request to be a callsite annotation, which currently does not exist, e.g.
inline foo()
to force inlining or
noinline bar()
to prevent it, probably with the first one erroring out if the call is not inlinable.
- Jweb_Guru 12y agoI believe #[inline(always)] and #[inline(never)] both work like this.
- kbenson 12y agoAccording to steveklabnik here[1], those are on the definition, not the callsite, which is the distinction here. Although from other info here, it sounds like having it on the definition is a prerequisite in some cases if you wanted to somehow specify it for the callsite, as it needs to be serialized in the crate metadata to be inline-able, and that's controlled somewhat by whether it was defined as inline capable. 1: https://news.ycombinator.com/item?id=9548248 https://news.ycombinator.com/item?id=9548248