Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up compilation by 20 seconds #11361

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions base/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

ccall(:jl_, Void, (Any,), "Precompiling")
ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_current_module, Ptr{Void})))
ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_base_module, Ptr{Void})))

# prime method cache with some things we know we'll need right after startup
precompile(!=, (Bool, Bool))
precompile(!=, (SubString{ASCIIString}, ASCIIString))
Expand Down
14 changes: 13 additions & 1 deletion base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ importall .Base64
include("io.jl")
include("iostream.jl")

const _is_sys0 = (JLOptions().image_file == C_NULL &&
(JLOptions().build_path != C_NULL &&
endswith(bytestring(JLOptions().build_path), "sys0")))

ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_current_module, Ptr{Void})))
ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_base_module, Ptr{Void})))

# system & environment
include("libc.jl")
using .Libc: getpid, gethostname, time, msync
Expand Down Expand Up @@ -313,7 +320,12 @@ function __init__()
init_parallel()
end

include("precompile.jl")
if !_is_sys0
ccall(:jl_, Void, (Any,), "Loading precompile.jl")
ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_current_module, Ptr{Void})))
ccall(:jl_, Void, (Any,), unsafe_load(cglobal(:jl_base_module, Ptr{Void})))
include("precompile.jl")
end

include = include_from_node1

Expand Down