# How to improve compilation time and loading time of packages?

**URL:** https://discourse.julialang.org/t/how-to-improve-compilation-time-and-loading-time-of-packages/26183
**Category:** Performance
**Tags:** question
**Created:** [July 9, 2019, 11:02am UTC](https://discourse.julialang.org/t/how-to-improve-compilation-time-and-loading-time-of-packages/26183 "2019-07-09T11:02:38Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![tencnivel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tencnivel/32/8662_2.png) [@tencnivel](https://discourse.julialang.org/u/tencnivel)
#### Post date: [July 10, 2019, 4:27am UTC](https://discourse.julialang.org/t/how-to-improve-compilation-time-and-loading-time-of-packages/26183/7 "2019-07-10T04:27:27Z")

</div>

Some additional information: the utility package is actually not recompiled if it is not changed.

If the utility package is modified, calling `@time using PostgresqlDAO` gives:

```julia
[Info: Recompiling stale cache file /home/myuser/.julia/compiled/v1.1/PostgresqlDAO/aXv1G.ji for PostgresqlDAO [9f278218-a07e-11e9-18c7-113e7cd19c36]
 15.867777 seconds (21.47 M allocations: 1.073 GiB, 2.41% gc time) 

```

If the utility package is NOT modified, calling `@time using PostgresqlDAO` gives:

```julia
7.756099 seconds (19.76 M allocations: 1015.470 MiB, 4.58% gc time)

```

Those 7.75 seconds are because the loading of the utility package implies the loading of its own dependencies. If I preload those dependencies (`using Tables, DataFrames, JuliaDB, Query, LibPQ, Dates, UUIDs, TickTock`) calling `@time using PostgresqlDAO` gives:

```julia
0.159535 seconds (205.38 k allocations: 10.726 MiB, 4.35% gc time)

```

No loading time anymore (I guess this is the case as long as the versions of the dependencies declared in the Manifest.toml of `MyMainProject` and `PostgresqlDAO` are the same).

So, all that to say that what actually takes time is not the compilation time but the loading time of the packages required by my utility package `PostgresqlDAO`. A quick search shows me that I am not the only one to find the loading of the packages very slow. I’ll dig into it to see if there’s useful anything I can find.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-improve-compilation-time-and-loading-time-of-packages/26183)._
