This is a fairly long, involved chunk of code that applies a lot of
heuristics:

https://github.com/JuliaLang/julia/blob/5c01387135ba9376bce9c86d115655ec9342e1b8/base/inference.jl#L1978-L2663

There's a fairly old issue open about adding an inline keyword:

https://github.com/JuliaLang/julia/issues/1106

Somewhat unusually, we've talked about allowing the keyword at call sites,
not just on function definitions.


On Wed, Jun 18, 2014 at 4:45 PM, John Myles White <[email protected]>
wrote:

> I think the code that controls inlining is mostly here:
> https://github.com/JuliaLang/julia/blob/master/base/inference.jl
>
> But you'll want to get a response from someone who really understands it.
>
>  -- John
>
> On Jun 18, 2014, at 1:30 PM, Sam L <[email protected]> wrote:
>
> Apologies if this is in the manual. I must have missed it or it was added
> since I read through it thoroughly.
>
> Under what conditions do functions get inlined by the compiler? I would
> guess that this does not have a simple answer. Are there any rules of thumb
> or ways to reason about when inlining is likely to happen? I've gathered
> from the section of the FAQ on native machine int arithmetic that if a
> function does get inlined, the compiler may make further optimizations
> depending on the context. Does whether or not a function is inlined depend
> only on the function, or also the caller?
>
> Also, how much does it matter if a function is inlined or not?
>
> Best,
> Sam
>
>
>

Reply via email to