10-09-2024, 03:24 AM
(This post was last modified: 10-09-2024, 06:02 AM by willcattoneeca.)
Hi Antti-L - yes, I think that the way demo.jl is re-running "include" statements forces Julia to re-compile the code each time. I suspect something similar will likely be the case where eval is being used. I was just profiling the second run of a function into which I'd splatted in all of Olex's code: https://github.com/willcattoneeca/TIMES....e.jl#L1192
The typical pattern is to bundle different bits of functionality as functions (or custom types) in modules that can then be precompiled, but I think even precompiled module code requires JIT compilation the first time it executes - implying that in Julia it would be more efficient to run scenarios in batches rather than one at a time, etc.
Edit - Actually, it looks like there is a solution available to avoid that slow first execution as well:
https://github.com/JuliaLang/PackageCompiler.jl
The typical pattern is to bundle different bits of functionality as functions (or custom types) in modules that can then be precompiled, but I think even precompiled module code requires JIT compilation the first time it executes - implying that in Julia it would be more efficient to run scenarios in batches rather than one at a time, etc.
Edit - Actually, it looks like there is a solution available to avoid that slow first execution as well:
https://github.com/JuliaLang/PackageCompiler.jl
