Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia 1.2 start-up is slower than 1.1 #32971

Closed
KristofferC opened this issue Aug 20, 2019 · 3 comments · Fixed by #33006
Closed

Julia 1.2 start-up is slower than 1.1 #32971

KristofferC opened this issue Aug 20, 2019 · 3 comments · Fixed by #33006
Assignees
Labels
compiler:latency Compiler latency regression Regression in behavior compared to a previous version
Milestone

Comments

@KristofferC
Copy link
Member

KristofferC commented Aug 20, 2019

Julia 1.2:

➜  ~ time julia -e ''
julia -e ''  0.22s user 0.10s system 110% cpu 0.287 total

Julia 1.1:

➜  ~ time julia11 -e ''
julia11 -e ''  0.15s user 0.09s system 105% cpu 0.236 total

With the following diff

diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl
index 0a71488859..3d834d653e 100644
--- a/stdlib/REPL/src/LineEdit.jl
+++ b/stdlib/REPL/src/LineEdit.jl
@@ -1239,6 +1239,9 @@ function write_prompt(terminal, p::Prompt)
     width = write_prompt(terminal, p.prompt)
     write(terminal, Base.text_colors[:normal])
     write(terminal, suffix)
+    if !REPL.Terminals.is_precompiling[]
+        exit(0)
+    end
     return width
 end

I measured the time to get to the prompt on 1.1 vs 1.2:

Julia 1.2:

➜  julia git:(release-1.2) ✗ time ./julia -q   
./julia -q  1.25s user 0.21s system 132% cpu 1.104 total

Julia 1.1:

➜  julia11 git:(release-1.1) ✗ time ./julia  -q
./julia -q  0.65s user 0.19s system 176% cpu 0.476 total

So we lost about 0.6s in time to prompt.

Running 1.2 with --trace-compile I see the following which is not there on 1.1

precompile(Tuple{typeof(Base.copy), Array{UInt8, 1}})
precompile(Tuple{typeof(Base.similar), Array{Base.Grisu.Bignums.Bignum, 1}})
precompile(Tuple{typeof(Base.length), Array{Base.Grisu.Bignums.Bignum, 1}})
precompile(Tuple{typeof(Base.deepcopy_internal), Array{UInt32, 1}, Base.IdDict{Any, Any}})
precompile(Tuple{typeof(Base.copy), Array{UInt32, 1}})

This should only affect the time to reach the banner though. Not sure what is making the prompt be so much slower.

@KristofferC KristofferC added regression Regression in behavior compared to a previous version compiler:latency Compiler latency labels Aug 20, 2019
@KristofferC
Copy link
Member Author

KristofferC commented Aug 20, 2019

Strangely, building Julia 1.2 locally, the extra precompile statements in --trace-compile are gone and startup is faster (but still not really 1.1 levels)

➜  julia git:(release-1.2) ✗ time ./julia -e ''
./julia -e ''  0.18s user 0.10s system 121% cpu 0.232 total

@KristofferC KristofferC added this to the 1.3 milestone Aug 20, 2019
@KristofferC
Copy link
Member Author

Time to prompt repod by:

time ./julia -e 'Base.run_main_repl(true, false, true, true, true)'

on 1.1 this takes 0.6s while on 1.2 it takes 1.1s.

@KristofferC
Copy link
Member Author

So on 1.1 we have the following trace running the above:

Screenshot 2019-08-20 at 13 59 02

with the heaviest functions being:

Screenshot 2019-08-20 at 13 59 07

Basically, nothing is done in true_main and most of the time is spent loading the sysimg.

Contrast this with 1.2:

Screenshot 2019-08-20 at 14 00 23

Screenshot 2019-08-20 at 14 00 38

where true_main now almost takes half a second(!).

We are also compiling stuff like refresh_multi_line which I would have thought the precompile script would already compile.

Comparing the number of precompile statements in 1.1 (1089) vs 1.2 (900) might mean that we are no longer precompiling a bunch of functions. And indeed, looking at a diff of the precompile files between the two versions (http://www.mergely.com/lGgrvfs9/) a bunch of precompile statements for e.g. refresh_multi_lineare now missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant