Skip to content

Commit 7a8db65

Browse files
author
Christopher Doris
committed
precompile init function to save 4-5 seconds
1 parent 450a781 commit 7a8db65

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1212
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1313
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
1414
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
15+
SnoopCompile = "aa65fe97-06da-5843-b5b1-d5d13cad87d2"
1516
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
1617
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
1718
UnsafePointers = "e17b2a0c-0bdf-430a-bd0c-3a23cae4ff39"

src/init.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ check_libpath(PyCall) = begin
99
end
1010
end
1111

12-
@init begin
12+
init() = begin
1313
# Check if libpython is already loaded (i.e. if the Julia interpreter was started from a Python process)
1414
CONFIG.isembedded = haskey(ENV, "JULIA_PYTHONCALL_LIBPTR")
1515

@@ -327,3 +327,6 @@ end
327327

328328
@debug "Initialized PythonCall.jl" CONFIG.isembedded CONFIG.isinitialized CONFIG.exepath CONFIG.libpath CONFIG.libptr CONFIG.pyprogname CONFIG.pyhome CONFIG.version CONFIG.isconda CONFIG.condaenv
329329
end
330+
precompile(init, ())
331+
332+
@init init()

0 commit comments

Comments
 (0)