Much worse import time for `Statistics` and `SparseArrays` on julia 1.9.0 nightly?

I am confused by this. Why would Statistics (or its dependency SparseArrays), a package in the standard library, have such a bad time to import? Anything I can do about this in my package that depends on Statistics? I have been trying to lower its TTFX and this has become a bottleneck. Other standard libraries do not seem to have these issues?

Version 1.9.0-DEV.874 (2022-06-30)
julia> @time_imports using Statistics
   2242.3 ms  ┌ SparseArrays 5.37% compilation time
   2265.5 ms  Statistics 6.25% compilation time

Version 1.7.0 (2021-11-30)
julia> @time @eval using Statistics
  0.002965 seconds (1.20 k allocations: 85.719 KiB, 92.20% compilation time)

Version 1.8.0-beta3 (2022-03-29)
julia> @time @eval using Statistics
  0.002675 seconds (1.16 k allocations: 81.145 KiB, 86.59% compilation time)

See here: Move out SparseArrays and SuiteSparse from the sysimage by KristofferC · Pull Request #44247 · JuliaLang/julia · GitHub for more discussion.

This is due to the removal of SparseArrays, Statistics and a few more stdlibs from the sysimage for 1.9. The increase in import time is expected, but understandably frustrating.

5 Likes