Suppose I have a basically empty package which depends on a “heavy” (i.e. slow to precompile/load) package. E.g.
module Foo using Zygote end
Why does precompiling my empty package (Julia 1.4.2) take significantly longer than precompiling the single heavy package?
# time to precompile and load Zygote julia> @time using Zygote [ Info: Precompiling Zygote [e88e6eb3-aa80-5325-afca-941959d7151f] 24.688621 seconds (28.59 M allocations: 1.660 GiB, 1.91% gc time) # time to just load Zygote julia> @time using Zygote 10.273923 seconds (27.57 M allocations: 1.613 GiB, 4.69% gc time) # time to precompile and load Foo when Zygote also needs to be precompiled julia> @time using Foo [ Info: Precompiling Foo [9717d8fb-fffd-47ec-8476-db8e9679d15e] 36.702254 seconds (37.17 M allocations: 2.075 GiB, 1.65% gc time)
In all cases here I have ensured all of Zygote’s dependencies are precompiled, so the timing should reflect just Zygote and Foo.
So shouldn’t precompiling Foo when Zygote also needs to be precompiled (the last case) not take any longer than the original 24 seconds?
This kind of thing comes up in my workflow alot since I often structure my analyses with modules that depend on each other like GenericAnalysisPackage <- MoreSpecificAnalysisPackage <- EvenMoreSpecificAnalysisPackage. When everything is precompiled this is great, but changing GenericAnalysisPackage triggers what feels like a needlessly slow recompilation.
Is this something simple which can be fixed, or is this secretly a more complex problem?