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

**URL:** <https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679>\
**Category:** Performance\
**Tags:** statistics, ttfx\
**Created:** [July 3, 2022, 1:07am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679 "2022-07-03T01:07:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [July 3, 2022, 1:07am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679/1 "2022-07-03T01:07:35Z")

</div>

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?

```julia
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)

```

---

<div class="post-metadata">

**Author:** ![rayegun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayegun/32/26729_2.png) [@rayegun](https://discourse.julialang.org/u/rayegun)\
**Post date:** [July 3, 2022, 4:23am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679/2 "2022-07-03T04:23:09Z")

</div>

See here: [Move out SparseArrays and SuiteSparse from the sysimage by KristofferC · Pull Request #44247 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/44247#issuecomment-1172847231) 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.

---

<div class="post-metadata">

**Author:** ![tfiers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tfiers/32/32427_2.png) [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Post date:** [January 12, 2023, 12:23am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679/3 "2023-01-12T00:23:15Z")

</div>

Sorry for re-animating.

I’ve read the linked PR and the links inside, but still wonder: whence the drive to move packages out of stdlib? Just for a Julia install of less MB?

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [January 12, 2023, 12:43am UTC](https://discourse.julialang.org/t/much-worse-import-time-for-statistics-and-sparsearrays-on-julia-1-9-0-nightly/83679/4 "2023-01-12T00:43:30Z")

</div>

One of the most cited reasons is that it allows for faster updating: when they are stdlibs they can only release an update whenever julia publishes a release. More points are explained [here](https://github.com/JuliaLang/julia/pull/45540#issuecomment-1147918438), where Viral B. Shah said:

> This is being planned not just [DelimitedFiles](https://github.com/JuliaLang/julia/pull/45540), but also [Statistics](https://github.com/JuliaLang/julia/pull/45594) and the [sparse ecosystem](https://github.com/JuliaLang/julia/pull/44247). In my opinion, there are several benefits:
> 
> 1. Allow broader participation in these packages from contributors
> 2. Faster bugfixing and upgrades without having to wait for whole Julia release cycles
> 3. Make them less special and allow for alternatives to evolve, or become more flexible (e.g. we want to support many new sparse data types and solvers in a first class way)
> 4. Consolidate capabilities in certain ecosystems (e.g. basic stats is spread out across too many packages like Statistics.jl, StatsBase.jl etc., and it is complex for new users to navigate - not to mention it is difficult to maintain)
