One of the first performance tips that you come across when learning Julia is the advice to not use global variables. This is usually not a very onerous requirement, as the global state is generally considered bad programming practice. Given how easy it is to fall into this trap and the large amount of performance degradation that can occur, it is important to keep this in mind when writing Julia code. This is particularly important when working on the REPL or in an IJulia notebook, since it is natural to create globals in those environments.
While we spend a lot of time in this chapter saying that globals are bad, they can often be very useful. After all, ease of use and programmer productivity is one of Julia's key features. So, our message is not "do not use globals." Rather, it is "do not use globals in performance critical parts...