# Compile time slowdown from 1.1 to 1.2

**URL:** <https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776>\
**Category:** Internals & Design\
**Created:** [August 20, 2019, 7:15pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776 "2019-08-20T19:15:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [August 20, 2019, 7:15pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/1 "2019-08-20T19:15:33Z")

</div>

I just tried to benchmark a suite of plots in 1.1.1 and then in 1.2.0 (Windows 64). It includes line plots, scatters, bars, contours and surfaces.

(The underlying notebook is at [JuliaTutorial/Tutorial\_04\_Plots.ipynb at master · PaulSoderlind/JuliaTutorial · GitHub](https://github.com/PaulSoderlind/JuliaTutorial/blob/master/Tutorial_04_Plots.ipynb), but you can easily download it as a .jl file to run it in the REPL).

Julia 1.1.1: 70 seconds  
Julia 1.2.0: 150 seconds

(on a half-decent notebook).

EDIT:  
I have now updated that notebook to use a slightly different `plot()` syntax that seems to avoid the 1.2.0 performance penalty. Basically, avoiding `title!()` etc.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 20, 2019, 9:41pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/2 "2019-08-20T21:41:26Z")

</div>

For my application, Julia 1.1 needs 41 s and Julia 1.2-RC3 51 s (second run from command line).  
Julia 1.1 with the option -O0 needs 33s. 🙂

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [August 20, 2019, 10:35pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/3 "2019-08-20T22:35:24Z")

</div>

I find travis a fairly (if unreliable and unscientific) indicator here. There apparently is a slow down in 1.2 for some packages:

> **[Travis CI - Test and Deploy with Confidence](https://app.travis-ci.com/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

> **[Travis CI - Test and Deploy with Confidence](https://app.travis-ci.com/JuliaApproximation/ApproxFunFourier.jl)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

> **[Travis CI - Test and Deploy with Confidence](https://app.travis-ci.com/JuliaMatrices/BandedMatrices.jl)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

and a marginal increase in speed in some:

> **[Travis CI - Test and Deploy with Confidence](https://app.travis-ci.com/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

But none of the slowdowns look like 2x you get (no I didn’t try your example).

Since compile time is a significant amount of Travis timing, it’s disappointing that the claimed improvement on this aspect in 1.2 is not apparent, but the slowdown is reasonable. Anyways, I guess its Julia 1.4 FTW!

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [August 20, 2019, 10:50pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/4 "2019-08-20T22:50:07Z")

</div>

I hope you don’t mind I’ve split this out from the meandering [TTFP thread](https://discourse.julialang.org/t/roadmap-for-a-faster-time-to-first-plot/22956/141). This seems worthy of a more focused discussion.

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [August 21, 2019, 12:22am UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/5 "2019-08-21T00:22:59Z")

</div>

I’ve been measuring precompilation time in Travis. There seems to be a slight improvement in 1.2.

- Julia 1.2.0-rc3.0: 57 sec  
[https://travis-ci.com/tkf/Transducers.jl/jobs/226451023#L267](https://travis-ci.com/tkf/Transducers.jl/jobs/226451023#L267)
- Julia 1.1.1: 64 sec  
[https://travis-ci.com/tkf/Transducers.jl/jobs/226451022#L264](https://travis-ci.com/tkf/Transducers.jl/jobs/226451022#L264)
- Julia 1.0.4: 117 sec  
[https://travis-ci.com/tkf/Transducers.jl/jobs/226451021#L266](https://travis-ci.com/tkf/Transducers.jl/jobs/226451021#L266)

I checked a few more examples and they had similar trend.

---

<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 21, 2019, 6:59am UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/6 "2019-08-21T06:59:35Z")

</div>

> [@dlfivefifty](#):
>
> it’s disappointing that the claimed improvement on this aspect in 1.2 is not apparent, but the slowdown is reasonable.

I don’t think there was much work on compiler latency for 1.2 since the people that usually work on that was working on multi threading for most of the release.

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [August 21, 2019, 7:16am UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/7 "2019-08-21T07:16:30Z")

</div>

I’ve tried to narrow down the problem with the slow plots (from Plots.jl) in 1.2.0. After some trial and error I noticed that this works equally fast in 1.1.1 and 1.2.0 (Win 10):

```julia
using Plots
gr()
x = -3:0.01:3
plot(x,cos.(x))
plot!(x,sin.(x))

```

However, adding the lines

```julia
title!("plot 1")
xlabel!("x")
ylabel!("function values")

```

almost doubles the time in 1.2.0 (but certainly not in 1.1.1). Using `pyplot()` instead of `gr()` gives the same general result. I’ll file an issue at Plots.jl.

EDIT:  
it seems as if using the syntax

```julia
plot(x,cos.(x),
title = "plot 1",
xlabel="x",
ylabel= "function values")
plot!(x,sin.(x))

```

avoids the 1.2.0 performance penalty. That is, avoid `title!, xlabel! and ylabel!`

I filed this to Plots.jl. (And no, I do not know the underlying reason for this.)

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 21, 2019, 7:41am UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/8 "2019-08-21T07:41:50Z")

</div>

Simple test (numbers of second execution from bash shown):

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.2.0 (2019-08-20)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> @time using PyPlot
  5.808863 seconds (12.36 M allocations: 620.836 MiB, 6.86% gc time)

julia> 

```

And with Julia 1.1 :

```julia
julia> @time using PyPlot
  5.167724 seconds (10.21 M allocations: 524.948 MiB, 4.05% gc time)

```

So about 11% advantage for Julia 1.1.

---

<div class="post-metadata">

**Author:** ![matthieu](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Post date:** [August 21, 2019, 12:33pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/9 "2019-08-21T12:33:37Z")

</div>

I’m a fan of your packages. One thing I don’t understand though is that BandedMatrices is quite slow to load( `using BandedMatrices` takes 6s on my computer). Do you understand why? Is this because of some sort of design pattern that is hard on Julia right now?

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [August 21, 2019, 7:56pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/10 "2019-08-21T19:56:51Z")

</div>

To be honest I’m not sure. Half of the time is from other packages BandedMatrices.jl depends on:

```julia
julia> @time using LazyArrays
  2.071962 seconds (3.63 M allocations: 317.976 MiB, 4.92% gc time)

julia> @time using MatrixFactorizations
  0.974763 seconds (2.17 M allocations: 120.067 MiB, 3.04% gc time)

julia> @time using FillArrays
  0.758794 seconds (964.94 k allocations: 46.056 MiB, 1.23% gc time)

julia> @time using BandedMatrices
  3.281776 seconds (21.11 M allocations: 1.304 GiB, 4.56% gc time)

```

But the 1.3GiB indicates something is going wrong. I’ve managed to fix it in the past by bisection so may try that again.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 21, 2019, 9:23pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/11 "2019-08-21T21:23:41Z")

</div>

Adding another data point: MathOptInterface (the layer underneath JuMP) has also seen a significant slow down (23min for tests vs 15min): [Travis CI - Test and Deploy Your Code with Confidence](https://travis-ci.org/JuliaOpt/MathOptInterface.jl/builds/575028355).

The difference is after a hacky fix for this wonderful compiler hang: [https://github.com/JuliaLang/julia/issues/32167](https://github.com/JuliaLang/julia/issues/32167).

Here’s a related and particularly interesting “feature” [https://github.com/JuliaOpt/MathOptInterface.jl/pull/834#issuecomment-523641110](https://github.com/JuliaOpt/MathOptInterface.jl/pull/834#issuecomment-523641110)

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [November 27, 2019, 10:51pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/12 "2019-11-27T22:51:16Z")

</div>

> Julia 1.1.1: 70 seconds  
> Julia 1.2.0: 150 seconds

On Julia 1.3.0 and Plots 0.28.1, I now get 35 seconds. Very nice.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 27, 2019, 10:59pm UTC](https://discourse.julialang.org/t/compile-time-slowdown-from-1-1-to-1-2/27776/13 "2019-11-27T22:59:27Z")

</div>

> [@dlfivefifty](#):
>
> To be honest I’m not sure. Half of the time is from other packages BandedMatrices.jl depends on:
> 
> ```julia
> 
> ```

Just an update, we’ve narrowed this down to being the method invalidation. Here’s a thread about it:

> <https://github.com/SciML/OrdinaryDiffEq.jl/issues/954>
>
> On my fast desktop, running \`@time using OrdinaryDiffEq\` takes 15 seconds.
> 
> A …couple of versions ago, it used to start much more quickly. I manually checked the loading time in a clean environment, and the biggest jump in load time happens when moving from 5.11.1 to 5.12.0.
> 
> The time goes from ~5sec to 15sec. Hopefully this can be improved.
> 
> \`\`\`
> (ODELoadTime) pkg\> add OrdinaryDiffEq@5.11                                                                            
> Updating registry at \`C:\\Users\\Jeremy\\.julia\\registries\\General\`                                                    
> Updating git-repo \`https://github.com/JuliaRegistries/General.git\`                                                  
> Resolving package versions...                                                                                        
> Installed OrdinaryDiffEq ─ v5.11.1                                                                                   
> Updating \`C:\\Users\\Jeremy\\temp\\ODELoadTime\\Project.toml\`                                                            
> \[1dea7af3\] ↑ OrdinaryDiffEq v5.10.0 ⇒ v5.11.1                                                                       
> Updating \`C:\\Users\\Jeremy\\temp\\ODELoadTime\\Manifest.toml\`                                                           
> \[01453d9d\] ↓ DiffEqDiffTools v1.3.0 ⇒ v0.14.0                                                                       
> \[1dea7af3\] ↑ OrdinaryDiffEq v5.10.0 ⇒ v5.11.1                                                                       
>                                                                                                                       
> (ODELoadTime) pkg\>                                                                                                    
>                                                                                                                       
> C:\\Users\\Jeremy\\AppData\\Local\\Cmder                                                                                   
> λ julia -q                                                                                                            
> julia\> using Pkg; Pkg.activate("C:\\\\Users\\\\Jeremy\\\\temp\\\\ODELoadTime\\\\")                                              
> "C:\\\\Users\\\\Jeremy\\\\temp\\\\ODELoadTime\\\\Project.toml"                                                                  
>                                                                                                                       
> (ODELoadTime) pkg\> precompile                                                                                         
> Precompiling project...                                                                                               
> Precompiling OrdinaryDiffEq                                                                                           
> \[ Info: Recompiling stale cache file C:\\Users\\Jeremy\\.julia\\compiled\\v1.1\\OrdinaryDiffEq\\DlSvy.ji for OrdinaryDiffEq \[
> 1dea7af3-3e70-54e6-95c3-0bf5283fa5ed\]                                                                                 
>                                                                                                                       
> julia\> @time using OrdinaryDiffEq                                                                                     
> 4.952551 seconds (10.26 M allocations: 612.715 MiB, 5.28% gc time)                                                  
>                                                                                                                       
> (ODELoadTime) pkg\> add OrdinaryDiffEq@5.12                                                                            
> Updating registry at \`C:\\Users\\Jeremy\\.julia\\registries\\General\`                                                    
> Updating git-repo \`https://github.com/JuliaRegistries/General.git\`                                                  
> Resolving package versions...                                                                                        
> Installed OrdinaryDiffEq ─ v5.12.0                                                                                   
> Updating \`C:\\Users\\Jeremy\\temp\\ODELoadTime\\Project.toml\`                                                            
> \[1dea7af3\] ↑ OrdinaryDiffEq v5.11.1 ⇒ v5.12.0                                                                       
> Updating \`C:\\Users\\Jeremy\\temp\\ODELoadTime\\Manifest.toml\`                                                           
> \[79e6a3ab\] + Adapt v1.0.0                                                                                           
> \[ec485272\] + ArnoldiMethod v0.0.4                                                                                   
> \[aae01518\] + BandedMatrices v0.13.0                                                                                 
> \[8e7c35d0\] + BlockArrays v0.10.1                                                                                    
> \[ffab5731\] + BlockBandedMatrices v0.5.2                                                                             
> \[01453d9d\] ↑ DiffEqDiffTools v0.14.0 ⇒ v1.3.0                                                                       
> \[1a297f60\] + FillArrays v0.7.4                                                                                      
> \[d25df0c9\] + Inflate v0.1.1                                                                                         
> \[5078a376\] + LazyArrays v0.12.3                                                                                     
> \[093fc24a\] + LightGraphs v1.3.0                                                                                     
> \[a3b82374\] + MatrixFactorizations v0.2.0                                                                            
> \[1dea7af3\] ↑ OrdinaryDiffEq v5.11.1 ⇒ v5.12.0                                                                       
> \[699a6c99\] + SimpleTraits v0.9.1                                                                                    
> \[47a9eef4\] + SparseDiffTools v0.9.2                                                                                 
> \[19fa3120\] + VertexSafeGraphs v0.1.0                                                                                
> \[9abbd945\] + Profile                                                                                                
>                                                                                                                       
> julia\>                                                                                                                
>                                                                                                                       
> C:\\Users\\Jeremy\\AppData\\Local\\Cmder                                                                                   
> λ julia -q                                                                                                            
> julia\> using Pkg; Pkg.activate("C:\\\\Users\\\\Jeremy\\\\temp\\\\ODELoadTime\\\\")                                              
> "C:\\\\Users\\\\Jeremy\\\\temp\\\\ODELoadTime\\\\Project.toml"                                                                  
>                                                                                                                       
> (ODELoadTime) pkg\> precompile                                                                                         
> Precompiling project...                                                                                               
> Precompiling OrdinaryDiffEq                                                                                           
> \[ Info: Recompiling stale cache file C:\\Users\\Jeremy\\.julia\\compiled\\v1.1\\OrdinaryDiffEq\\DlSvy.ji for OrdinaryDiffEq \[
> 1dea7af3-3e70-54e6-95c3-0bf5283fa5ed\]                                                                                 
>                                                                                                                       
> julia\> @time using OrdinaryDiffEq                                                                                     
> 15.079790 seconds (59.11 M allocations: 3.677 GiB, 5.76% gc time)                                                    
> \`\`\`
