June 2019
Intermediate to advanced
218 pages
5h 19m
English
The Julia compiler has certain heuristics on which functions to inline and which should not be. These are typically based on the size of the function bodies in order to limit the increase in code size due to inlining. Sometimes, however, in performance-sensitive functions that are called many times in inner loops (for example, array indexers), we will want to override this heuristic if it fails. In other words, we will want to inline a function even when the compiler thinks it should not be inlined.
For this purpose, Julia provides the @inline macro. This macro needs to be placed in front of a function definition. When that function is called, its body will be placed inline at the location where it is called.
Read now
Unlock full access