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 , 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.
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.
I find travis a fairly (if unreliable and unscientific) indicator here. There apparently is a slow down in 1.2 for some packages:
and a marginal increase in speed in some:
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!
I hope you don’t mind I’ve split this out from the meandering TTFP thread . This seems worthy of a more focused discussion.
2 Likes
tkf
August 21, 2019, 12:22am
5
I’ve been measuring precompilation time in Travis. There seems to be a slight improvement in 1.2.
I checked a few more examples and they had similar trend.
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.
4 Likes
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):
using Plots
gr()
x = -3:0.01:3
plot(x,cos.(x))
plot!(x,sin.(x))
However, adding the lines
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
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.)
3 Likes
Simple test (numbers of second execution from bash shown):
_ _ _(_)_ | 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> @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.
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?
To be honest I’m not sure. Half of the time is from other packages BandedMatrices.jl depends on:
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.
1 Like
odow
August 21, 2019, 9:23pm
11
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 .
The difference is after a hacky fix for this wonderful compiler hang: 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
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.
3 Likes
Just an update, we’ve narrowed this down to being the method invalidation. Here’s a thread about it:
opened 07:54PM - 02 Nov 19 UTC
closed 10:14AM - 03 Nov 19 UTC
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)
```
2 Likes