Launch julia and load all stdlibs after install, to move any OS checks to install time
IanButterworth opened this issue · 8 comments
xref JuliaLang/julia#54366 (comment)
This needs to be implemented before 1.11 is released. Ideally before the final RC so people can check it out.
Happy to add it on this end, if someone figures out what exact Julia expression we should run.
Also, just FYI: at the moment we can't release new builds to everyone because we are in the middle of changing the code signing for Windows. Or rather, I switched everything over already, but then it turned out that the new cert is not the right one, so we now have to wait until this is resolved...
Maybe:
julia --startup-file=no -e 'import Base64; foreach(p -> @eval(import $(Symbol(p))), readdir(pkgdir(Base64, "..")))'
Base64 isn't special here, just a zero dep stdlib to find the stdlib source directory.
Probably only worth doing this on 1.10+ where stdlibs can have pkgimages.
In terms of timing, on my M2 macbook on a reasonable internet connection this would add 16s to install time.
(I see Statistics
and its ext is getting precompiled, which it shouldn't.. so that's a julia bug to fix)
% time julia +nightly --startup-file=no -e 'import Base64; foreach(p -> @eval(import $(Symbol(p))), readdir(pkgdir(Base64, "..")))'
Precompiling Statistics...
1 dependency successfully precompiled in 1 seconds
Precompiling SparseArraysExt...
1 dependency successfully precompiled in 1 seconds. 4 already precompiled.
julia +nightly --startup-file=no -e 2.88s user 1.38s system 25% cpu 16.538 total
% time julia +nightly --startup-file=no -e 'import Base64; foreach(p -> @eval(import $(Symbol(p))), readdir(pkgdir(Base64, "..")))'
julia +nightly --startup-file=no -e 1.36s user 0.84s system 223% cpu 0.985 total
Personally I think that's quite excessive, and I would've thought it would be worse for a Windows user?
We don't have to wait into it finished, right? I could just launch a detached process that runs that and forget about it?
True
The Statistics issue above was because of a custom Statistics version being reachable in my default env. So we need to
JULIA_LOAD_PATH=@stdlib julia +nightly --startup-file=no -e 'import Base64; foreach(p -> @eval(import $(Symbol(p))), readdir(pkgdir(Base64, "..")))'
From a little testing this is more robust
JULIA_LOAD_PATH=@stdlib julia +nightly --startup-file=no -e 'foreach(p -> @eval(import $(Symbol(p))), filter!(x -> isfile(joinpath(Sys.STDLIB, x, "src", "$(x).jl")), readdir(Sys.STDLIB)))'
@davidanthoff can we get this in before the final 1.11 rc so that we can test it in the wild?