# Slow precompile time with ControlSystems.jl

**URL:** <https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843>\
**Category:** New to Julia\
**Tags:** question, control\
**Created:** [August 13, 2020, 2:17am UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843 "2020-08-13T02:17:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [August 13, 2020, 2:17am UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/1 "2020-08-13T02:17:38Z")

</div>

I’m new to Julia, and I’m excited at the Control Systems design capability! I’m using macOS Catalina on a late 2013 MacBook Pro (2.4 GHz duel-core i5).

I understand the initial startup will take longer than subsequent startups due to _just in time_ compiling, and other concepts I don’t fully understand! But I’m finding **extremely long pre-compile times** when loading `ControlSystems.jl`. Is this typical, or an indication that something is wrong? It’s odd to me that the package requires 1.418 GiB, is that typical for packages?

```julia
julia> @time using ControlSystems
[Info: Precompiling ControlSystems [a6e380b2-a6ca-5380-bf3e-84a91bcd477e]
139.132995 seconds (26.78 M allocations: 1.418 GiB, 0.37% gc time)

```

I know this is a basic question, I’d appreciate someone pointing me in the right direction!

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [August 13, 2020, 6:31am UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/2 "2020-08-13T06:31:12Z")

</div>

Hello and welcome to the community! Which versions of Julia and Controlsystems.jl are you using? The precompile time can be quite long, in particular if you haven’t previously precompiled Ordinarydiffeq.jl

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 13, 2020, 6:59am UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/3 "2020-08-13T06:59:14Z")

</div>

> [@cadojo](#):
>
> It’s odd to me that the package requires 1.418 GiB, is that typical for packages?

This is just the total amount of memory allocated during the operation. You can ignore it.

---

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [August 13, 2020, 5:25pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/4 "2020-08-13T17:25:36Z")

</div>

Thank you! I’m using the following versions:

```julia
julia> versioninfo()
Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, haswell)

```

```julia
"ControlSystems" => v"0.6.0"

```

That makes sense, sounds good. So the 2+ minute pre-compile time typical for weaker laptops then?

---

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [August 13, 2020, 5:27pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/5 "2020-08-13T17:27:18Z")

</div>

Thank you! To check my understanding, is `1.1418 GiB` the amount that each package _keeps_ in memory after `using Package`? Or is that memory unallocated after loading. Seems like the memory is unallocated.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 13, 2020, 5:29pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/6 "2020-08-13T17:29:37Z")

</div>

> [@cadojo](#):
>
> Thank you! To check my understanding, is `1.1418 GiB` the amount that each package _keeps_ in memory after `using Package` ? Or is that memory unallocated after loading. Seems like the memory is unallocated.

It’s the total amount that was allocated (cumulative sum) during loading. Almost all of it will have been unallocated.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [August 13, 2020, 5:34pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/7 "2020-08-13T17:34:04Z")

</div>

Yep, everything seems to be up to date. Hopefully you’ll only experience the precompilation once, and subsequent uses of the package should be snappier (until it is updated, when you have to precompile again).

---

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [August 13, 2020, 5:43pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/8 "2020-08-13T17:43:36Z")

</div>

Thanks for the help, that makes sense. Last question - I need to precompile every time I start Julia, is that the right workflow? I see `PackageCompiler.jl` can save those package binaries for use next time I start Julia, but to clarify, without `PackageCompiler.jl` you need to pre-compile package with every new Julia instance?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [August 13, 2020, 6:33pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/9 "2020-08-13T18:33:40Z")

</div>

It should only recompile once and then never again until the package or one of its dependencies is updated. Did you perhaps update any package since the last precompilation? Or did you get a warning message during the precompilation?

---

<div class="post-metadata">

**Author:** ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Post date:** [August 13, 2020, 9:31pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/10 "2020-08-13T21:31:54Z")

</div>

It’s no longer precompiling every startup, I must have been mistaken.

Following these steps…

1. `julia`
2. `@time using ControlSystems`

I get the following output:  
`39.675718 seconds (48.37 M allocations: 2.587 GiB, 3.47% gc time)`

It says nothing about pre-compiling, it just takes ~40 seconds to load ControlSystems. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [August 13, 2020, 9:43pm UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/11 "2020-08-13T21:43:11Z")

</div>

I am not sure if you are aware, but I really recommend you looking into: Revise.jl, jupyter notebooks, or Pluto.jl (which one depends on your workflow) to avoid having to load such packages frequently.

I use Jupyter notebooks for data analysis. I load a notebook in the morning, and work in there for the whole day, so I only pay the price for loading, one time, while I am eating breakfast. If you declare many new structures it may not be viable however.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 14, 2020, 5:17am UTC](https://discourse.julialang.org/t/slow-precompile-time-with-controlsystems-jl/44843/12 "2020-08-14T05:17:44Z")

</div>

> [@Henrique\_Becker](#):
>
> so I only pay the price for loading, one time, while I am eating breakfast

Loading rarely takes more than a minute for me. I guess you must be a fast eater 😉
