It seems like the order of loading packages can have some impact on the time, mostly got curious about why this happened.
Looking at two packages for different load configurations I get
albheim@gilbert ~> hyperfine "julia --project=@control -e 'using Plots; using ControlSystems'"
Benchmark 1: julia --project=@control -e 'using Plots; using ControlSystems'
Time (mean ± σ): 16.764 s ± 0.683 s [User: 16.381 s, System: 1.196 s]
Range (min … max): 16.027 s … 18.150 s 10 runs
albheim@gilbert ~> hyperfine "julia --project=@control -e 'using ControlSystems; using Plots'"
Benchmark 1: julia --project=@control -e 'using ControlSystems; using Plots'
Time (mean ± σ): 19.338 s ± 1.034 s [User: 18.889 s, System: 1.288 s]
Range (min … max): 18.319 s … 20.993 s 10 runs
albheim@gilbert ~> hyperfine "julia --project=@control -e 'using Plots, ControlSystems'"
Benchmark 1: julia --project=@control -e 'using Plots, ControlSystems'
Time (mean ± σ): 16.328 s ± 0.807 s [User: 15.978 s, System: 1.234 s]
Range (min … max): 15.557 s … 17.741 s 10 runs
albheim@gilbert ~> hyperfine "julia --project=@control -e 'using ControlSystems, Plots'"
Benchmark 1: julia --project=@control -e 'using ControlSystems, Plots'
Time (mean ± σ): 20.156 s ± 1.245 s [User: 19.665 s, System: 1.279 s]
Range (min … max): 18.879 s … 22.500 s 10 runs
which seems to show that using A, B
is the same as using A; using B
but different from using B, A
.
I know that ControlSystems
depends on Plots
, so maybe there is something from there? Can we say that using A, B
will be better than using B, A
when A
is a dependency of B
in general? Or was that just a coincidence here?
It is a large enough difference that I feel it might be important for packages to think about the order they import things, but maybe this is just a special case?
Will look at it more when I have time, just thought I would post to see if anyone knew more.