Skip to content

Commit

Permalink
Exclude JLLs from system image
Browse files Browse the repository at this point in the history
This excludes JLLs from the system image, which prevents them from
affecting start-up time, while still participating in Pkg resolution
logic.  We will be able to add these back in to the system image once we
have fully transitioned to a lazy ccall interface.
  • Loading branch information
staticfloat committed Dec 1, 2020
1 parent 4a7c5bd commit 3b82a7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
21 changes: 1 addition & 20 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if Base.is_primary_base_module
# load some stdlib packages but don't put their names in Main
let
# Stdlibs sorted in dependency, then alphabetical, order by contrib/print_sorted_stdlibs.jl
# Run with the `--exclude-jlls` option to filter out all JLL packages
stdlibs = [
# No dependencies
:ArgTools,
Expand All @@ -30,55 +31,35 @@ let
:Libdl,
:Logging,
:Mmap,
:MozillaCACerts_jll,
:NetworkOptions,
:SHA,
:Serialization,
:Sockets,
:Unicode,

# 1-depth packages
:CompilerSupportLibraries_jll,
:DelimitedFiles,
:GMP_jll,
:LibOSXUnwind_jll,
:LibUV_jll,
:LibUnwind_jll,
:LinearAlgebra,
:Markdown,
:MbedTLS_jll,
:OpenLibm_jll,
:PCRE2_jll,
:Printf,
:Random,
:Tar,
:Zlib_jll,
:dSFMT_jll,
:libLLVM_jll,
:nghttp2_jll,
:p7zip_jll,

# 2-depth packages
:Dates,
:Distributed,
:Future,
:InteractiveUtils,
:LibGit2,
:LibSSH2_jll,
:MPFR_jll,
:OpenBLAS_jll,
:Profile,
:SparseArrays,
:UUIDs,

# 3-depth packages
:LibCURL_jll,
:LibGit2_jll,
:REPL,
:SharedArrays,
:Statistics,
:SuiteSparse,
:SuiteSparse_jll,
:TOML,
:Test,

Expand Down
22 changes: 22 additions & 0 deletions contrib/print_sorted_stdlibs.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/usr/bin/env julia
using TOML

function check_flag(flag)
idxs = findall(flag .== ARGS)
for idx in reverse(idxs)
popat!(ARGS, idx)
end
return !isempty(idxs)
end

if check_flag("--help") || check_flag("-h")
println("Usage: julia print_sorted_stdlibs.jl [stdlib_dir] [--exclude-jlls]")
end

# Allow users to ask for JLL or no JLLs
exclude_jlls = check_flag("--exclude-jlls")

# Default to the `stdlib/vX.Y` directory
STDLIB_DIR = get(ARGS, 1, joinpath(@__DIR__, "..", "usr", "share", "julia", "stdlib"))
vXYdirs = readdir(STDLIB_DIR)
Expand Down Expand Up @@ -59,9 +74,16 @@ end

sorted_projects = sort(collect(keys(project_depths)), lt=project_isless)

if exclude_jlls
filter!(p -> !endswith(p, "_jll"), sorted_projects)
end

# Print out sorted projects, ready to be pasted into `sysimg.jl`
last_depth = 0
println(" # Stdlibs sorted in dependency, then alphabetical, order by contrib/print_sorted_stdlibs.jl")
if exclude_jlls
println(" # Run with the `--exclude-jlls` option to filter out all JLL packages")
end
println(" stdlibs = [")
println(" # No dependencies")
for p in sorted_projects
Expand Down

0 comments on commit 3b82a7e

Please sign in to comment.