Julia v1.6: `using` is faster but first call is slower

Thanks a lot to all contributors to reduce latency in the new release candidate of Julia v1.6 - great work!

I recognized that using can be significantly faster in Julia v1.6, but the first function call becomes significantly slower. Summing up both, there is still a gain of ca. 15% in total, but I couldn’t find anything in NEWS.md indicating why the first function call becomes slower. Is there some trivial optimization opportunity that we missed in Trixi.jl?

Here is an example. On Julia v1.5.3, I get

julia> using Pkg; Pkg.activate(temp=true); Pkg.add("Trixi")

julia> @time using Trixi # running this block the second time, no precompilation included
 12.832311 seconds (39.01 M allocations: 2.121 GiB, 4.85% gc time)

julia> @time trixi_include(default_example())
[...]
 23.761264 seconds (61.87 M allocations: 3.114 GiB, 4.62% gc time)

On Julia v1.6.0-rc1, I get

julia> using Pkg; Pkg.activate(temp=true); Pkg.add("Trixi")

julia> @time using Trixi # running this block the second time, no precompilation included
  3.260989 seconds (9.36 M allocations: 666.299 MiB, 3.18% gc time, 0.09% compilation time)

julia> @time trixi_include(default_example())
[...]
 28.165085 seconds (66.61 M allocations: 3.797 GiB, 4.24% gc time, 0.09% compilation time)
1 Like

I don’t think this is an intended feature, hence no need to document it. It’s more likely that compilation of that specific function got somehow slower.

3 Likes