I am occasionally observing a slight delay (around 1/2s) in REPL completion (with TAB) in 1.12.
Is there any way to debug what is going on under the hood? I am using Revise, but I am not sure if it is called just when I try completion.
I am occasionally observing a slight delay (around 1/2s) in REPL completion (with TAB) in 1.12.
Is there any way to debug what is going on under the hood? I am using Revise, but I am not sure if it is called just when I try completion.
Are you using OhMyREPL? For me that was the cause of the delay in 1.12
No, only Revise and EmacsVterm.
I see the same problem, using the pure Julia 1.12 REPL on Linux. Only sometimes. Could not figure out yet under which conditions.
Also happens to me sometimes but haven’t figured out a cause.
You can try starting the profiler and do the completion during it. Something like this. The shorter the sleep you can do, the better.
julia> using Profile
julia> t = @async @profile sleep(10)
julia> repro[tab]
julia> wait(t)
julia> Profile.print()
Then ignore anything that doesn’t stem from a completion function handler
Thanks! A printout is attached in case someone wants to dig into it. The string I am trying to complete is fo, could be a method, so a lot of time is spent in @Compiler/src/abstractinterpretation.jl.
(NOTE: file is not toml, it’s the only thing that is allowed for upload)
profile.toml (2.5 MB)
Try starting with --trace-compile=stderr to see what’s being compiled (or you could use the same async trick with @trace_compile to turn it on temporarily)
julia> @async @trace_compile sleep(10)
This is slow on 1.12.4, but seems to be fast on the upcoming 1.12.5 (tested with 1.12-nightly)
foo.jl
import DataStructures
using REPL.REPLCompletions
input_str = "Base.ma"
@time begin
r = completions(input_str, lastindex(input_str));
end
> julia +release --startup-file=no foo.jl
4.561883 seconds (15.53 M allocations: 753.029 MiB, 7.58% gc time, 99.93% compilation time)
vs
> julia +1.12-nightly --startup-file=no foo.jl
0.019530 seconds (36.24 k allocations: 1.937 MiB, 79.04% compilation time)
It’s almost definitely `parse_brackets` should probably specialize on the function · Issue #600 · JuliaLang/JuliaSyntax.jl · GitHub, which was fixed in 1.12.5.
For me it happens on REPL startup: after the first completion delay everything goes back to normal. 1.12.3 (maybe I’m a little old here)
Thanks to the OP! Made me realize that a similar very bothering delay I had was due to a stupid piracy in my startup (|(x, f::Function) = f(x)) that I even forgot I had.
EDIT: and v1.12.5 also solves the issue.
Thanks, that fixes the issue for me.