November 2017
Beginner
316 pages
6h 40m
English
Whenever you create a complete module and try to load it in, it may take up to several seconds before the module is completely loaded for usage.
Whenever Julia loads a module, it starts reading code from the top-level statements one at a time. Then these top-level statements are further lowered down, and then possibly interpreted or compiled and executed.
Let's first look at a simple module, where we try to calculate a huge sum that will mimic the loading of a heavy module in the system. In order for pre-compilation to work, the module must be saved in a module format and added to Julia’s load path.
julia> module SampleCode export sum_of_numbers sum_of_numbers = 0 for num in 1:1000000000 sum_of_numbers += num ...
Read now
Unlock full access