Julia startup speed cut in half. Was: (Unofficial) Julia 1.9 for lower latency (startup)

[None of this needs 1.9, I’m timing with 1.8.1 currently.]

FYI: The search in the docs finds nothing for filter_stdlibs only for filter_stdlibs=true (and then only under Apps). That seems like a bug in the search function not your package (or then only for the markup you use).

Would you be opposed to the official Julia binary download including a non-default sysimage for scripting and benchmarks (I think Debian’s would approve of it, though maybe only if it’s an official one) with it, as I describe below.

For some benchmarks, e.g. Debian benchmark game, it’s critical to reduce startup or we never make top spot, and Julia’s default sysimage blocks that. What I describe blow, will put us in the top spot for many of its sub-benchmarks already.

Anyway I used your example, modified this way, and it only took a few min. to make:
https://julialang.github.io/PackageCompiler.jl/stable/sysimages.html

julia> create_sysimage(["Example"]; filter_stdlibs=true, incremental=false, sysimage_path="Scripting_benchmark_Sysimage.so")

First the good news, it cuts startup latency in half, to 94.1 ms from 169.2 ms and makes the sysimage, 67% smaller, to 75 MB (and I’m not using new sysimage strip option[s] in 1.9, so likely should do better), according to:

$ hyperfine --min-runs 100 "julia -J Scripting_benchmark_Sysimage.so --startup-file=no --history-file=no --compile=min -e ''"

Doing something actual:

$ julia -J Scripting_benchmark_Sysimage.so --startup-file=no --history-file=no -O0 -e 'println(\"Hello world\")

though trivial adds only 4.4 ms, or 9.3 ms with -O0.

Now some strangeness/bug, and not relevant to scripting(?), I get:

┌ Warning: REPL provider not available: using basic fallback
└ @ Base client.jl:424

and the julia> prompt is no longer green, but otherwise (all?) stuff seems to work in the REPL, until you exit, then you hit some infinite loop.

Some things or maybe just rand() do not work, and would be better to fix, at least if in official download (I think rand() the major exception, and do you know how to fix your example to include Random?), unless you do like:

$ julia -J ExampleSysimage.so --startup-file=no --history-file=no -O0 -e 'using Random; println(rand())'

This is slow (and I guess many similar):

$ time julia -J ExampleSysimage.so --startup-file=no --history-file=no -e 'using Random'

I stopped the web browser etc. to time, but I’m using julia from juliaup, that adds some overhead, forgot to run as, which is better: [see also $ whereis julia]

$ ~/.julia/juliaup/julia-1.8.1+0.x64/bin/julia …