January 2020
Intermediate to advanced
532 pages
13h 31m
English
Sometimes, it is convenient to use global variables because they are accessible from anywhere in the code. However, application performance may suffer when using global variables. Let's figure out together how badly performance is affected. Here is a very simple function that just adds two numbers together:
variable = 10function add_using_global_variable(x) return x + variableend
To benchmark this code, we will use the great BenchmarkTools.jl package, which can repeatedly run the code many times and report back some performance statistics. Let's get started:

It seems a little slow for just adding ...
Read now
Unlock full access