JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.64k stars 5.48k forks source link

REPL keyboard input lag at start up #35644

Open MFairley opened 4 years ago

MFairley commented 4 years ago

julia version 1.4.1 macOS 10.15.4

I have an issue where if either Revise or OhMyREPL are loaded at start up then the Julia REPL cannot accept keyboard input quickly after displaying Julia> for ~2 seconds. If I type something as soon as the prompt displays then it will appear after about ~2 seconds. It's irritating because it appears that the REPL should accept inputs but has an obvious lag.

My startup.jl file is as follows

atreplinit() do repl
    @async try
        sleep(0.1)
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
        @warn("Could not load Revise.")
    end
end

atreplinit() do repl
    try
        @eval using OhMyREPL
        @eval enable_autocomplete_brackets(false)
    catch e
        @warn "error while importing OhMyREPL" e
    end
end

If I comment out both of these then the issue goes away. Either one of them by themselves will cause the issue.

KristofferC commented 4 years ago

That's just normal loading time from loading packages. You can look at https://julialang.github.io/PackageCompiler.jl/dev/examples/ohmyrepl/ for a technique on how to get rid of it.

MFairley commented 4 years ago

Thanks. I don't remember having the issue before. Shouldn't Julia hold back from displaying the prompt until it is ready to accept input?

KristofferC commented 4 years ago

In the case of OhMyREPL it isn't until a key is pressed that a lot of code is getting compiled.

MFairley commented 4 years ago

Got it, although I have the same issue with only Revise too.