So far in this chapter, we have focused on making our functions run faster. But sometimes, the best way to make any code faster is to do less work. This involves either changing the algorithm or moving the computation to compile time, which leaves less work to do at runtime.
Using macros for performance
The Julia compilation process
For a dynamic language such as Julia, the terms compile time and runtime are not always clearly defined. In some sense, everything happens at runtime, because Julia code is usually not compiled ahead of time to a binary.
However, there are clearly divided processes that occur from when the code is read from disk to when it is finally executed on the CPU, which is shown in the following...