[The file now adds 3-6+ seconds, with Revise only, to startup-time.++] Disabled would be nice, probably a common benchmarking mistake to not disable it, and I'm not sure why you would ever want to have it on with -e
or a program given. At least if you want you could always as for it and keep compatibility with older versions.
Seems 1.5 is still delayed with 1.6 stuff being backported. That would be nice.
https://github.com/timholy/Revise.jl/pull/484#issuecomment-630468664
++ We might have a boiling-frog situation (for me was forgotten, until I changed the file), where the same startup file gradually gets slower, because of upgraded packages/script (here for same) and/or julia:
$ julia-1.5-DEV
3.037262 seconds (2.35 M allocations: 125.855 MiB, 0.54% gc time)
$ ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia
6.557927 seconds (1.31 M allocations: 77.991 MiB, 0.19% gc time)
$ ~/julia-1.4.0/bin/julia
4.805883 seconds (2.05 M allocations: 112.337 MiB, 0.47% gc time)
With current startup-file, from recommendation:
@time using Revise
#older (still) recommended way is not as slow:
#atreplinit() do repl
# try
# @eval using Revise
# @async Revise.wait_steal_repl_backend()
# catch e
# @warn(e.msg)
# end
#end
Perhaps it'd be nicer to be able to specify an additional startup file that is run after the REPL is initiated?
For example, I'd like to set my default display size to make it consistent across all of the systems I work on and my regression tests, but I have to do this manually every time. The existing startup file is run before the REPL is initialized. Hence, this is an error (on 1.5) if I put it in the startup file: Base.active_repl.options.iocontext[:displaysize] = (45,72)
.
Usually, atreplinit
is used for that.
Usually,
atreplinit
is used for that.
You learn something every day. Perhaps this helpful hint might be referenced from the [command line argument reference] (https://docs.julialang.org/en/latest/manual/getting-started/) where it says --startup-file={yes|no}
right after "Load ~/.julia/config/startup.jl" it could say something like, "See atreplinit
to launch specific options after the REPL has been initialized."
So you agree with disabling the file (unless for REPL)? You could always enable it for your scripts? It's a trivial PR, and I would say needs to happen. Maybe for 1.5... or 1.6 if considered to late.
I do rather agree that startup files should probably only be for REPL convenience.
For my use case, I use-L
, but I'm still landing in the REPL; I'm loading my current regression test cases so I can continue working on it without copy/paste them. I was surprised to learn that this script is loaded before the REPL is initialized, so, changing the column width has to be put in an @exec
within atreplinit
call. I would have expected that the REPL would have initialized before my -L
script would have been invoked; so that this would work without having to know about atreplinit
. As for the broader question, yea, I don't see a reason for the start.jl
to be run if you are not interactive; in fact, it might create subtle bugs with current behavior. I can imagine being on a support call where someone's start.jl
breaks a production script, and it being a very hard-to-find, non-repeatable issue.
I'm not saying -L should disable, as it gets you in the REPL. You could do that with the option, or additionally with -e ""
I did a test (the proposed change would get rid of the 11 sec startup delay, only because of Revise):
$ julia -t2 -p3 -L test-L.jl
11.434970 seconds (2.20 M allocations: 122.943 MiB, 0.31% gc time)
Palli
From worker 2: Palli
From worker 4: Palli
[banner]
From worker 3: Palli
julia>
I typically set up stuff like github token keys and other stuff in the startup file. I don't see why it should be REPL only.
The isinteractive()
use-case is tracked by https://github.com/JuliaLang/julia/issues/10779.
github token keys and other stuff
I'm not sure what other stuff is appropriate, but at least for normal users they would just want to run their code, and github stuff not needed? Can be done differently, independently of Julia? Or at least you could enable the file.
Most helpful comment
I do rather agree that startup files should probably only be for REPL convenience.