Skip to content

Commit 0d52973

Browse files
authored
Add some precompiles for Test (#37754)
Work improving latency in packages often exploits the tests. It's mildly annoying when the inference time of methods in Test stands out as the major contributors, so let's get rid of that annoyance.
1 parent bd42c0a commit 0d52973

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contrib/generate_precompile.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ if Libdl !== nothing
119119
"""
120120
end
121121

122+
Test = get(Base.loaded_modules,
123+
Base.PkgId(Base.UUID("8dfed614-e22c-5e08-85e1-65c5234f0b40"), "Test"),
124+
nothing)
125+
if Test !== nothing
126+
hardcoded_precompile_statements *= """
127+
@assert precompile(Tuple{typeof(Test.do_test), Test.ExecutionResult, Any})
128+
@assert precompile(Tuple{typeof(Test.testset_beginend), Tuple{String, Expr}, Expr, LineNumberNode})
129+
@assert precompile(Tuple{typeof(Test.finish), Test.DefaultTestSet})
130+
@assert precompile(Tuple{typeof(Test.eval_test), Expr, Expr, LineNumberNode, Bool})
131+
"""
132+
end
133+
122134
function generate_precompile_statements()
123135
start_time = time_ns()
124136
debug_output = devnull # or stdout

0 commit comments

Comments
 (0)