@@ -61,7 +61,7 @@ let known_type_cache = IdDict{Tuple{Module,Tuple{Vararg{Symbol}},Symbol},Bool}()
6161 end
6262end
6363
64- function add_repr!(list, modgens:: Dict{Module, Vector{Method}} , mi:: MethodInstance , topmod:: Module = mi. def. module; check_eval:: Bool , time= nothing , kwargs... )
64+ function add_repr!(list, modgens:: Dict{Module, Vector{Method}} , mi:: MethodInstance , topmod:: Module = mi. def. module; check_eval:: Bool , time= nothing , suppress_time :: Bool = false , kwargs... )
6565 # Create the string representation of the signature
6666 # Use special care with keyword functions, anonymous functions
6767 tt = Base. unwrap_unionall(mi. specTypes)
@@ -83,9 +83,9 @@ function add_repr!(list, modgens::Dict{Module, Vector{Method}}, mi::MethodInstan
8383 # Keyword function
8484 fname = mkw. captures[1 ] === nothing ? mkw. captures[2 ] : mkw. captures[1 ]
8585 fkw = " Core.kwftype(typeof($fname ))"
86- return add_if_evals!(list, topmod, fkw, paramrepr, tt; check_eval= check_eval , time= time )
86+ return add_if_evals!(list, topmod, fkw, paramrepr, tt; check_eval, time, suppress_time )
8787 elseif mkwbody != = nothing
88- ret = handle_kwbody(topmod, m, paramrepr, tt; check_eval = check_eval , kwargs... )
88+ ret = handle_kwbody(topmod, m, paramrepr, tt; check_eval, kwargs... )
8989 if ret != = nothing
9090 push!(list, append_time(ret, time))
9191 return true
@@ -107,7 +107,7 @@ function add_repr!(list, modgens::Dict{Module, Vector{Method}}, mi::MethodInstan
107107 mkwc = match(kwbodyrex, cname)
108108 if mkwc === nothing
109109 getgen = " typeof(which($(caller. name) ,$csigstr ).generator.gen)"
110- return add_if_evals!(list, topmod, getgen, paramrepr, tt; check_eval= check_eval , time= time )
110+ return add_if_evals!(list, topmod, getgen, paramrepr, tt; check_eval, time, suppress_time )
111111 else
112112 getgen = " which(Core.kwfunc($(mkwc. captures[1 ]) ),$csigstr ).generator.gen"
113113 ret = handle_kwbody(topmod, caller, cparamrepr, tt; check_eval = check_eval, kwargs... ) # , getgen)
@@ -123,9 +123,9 @@ function add_repr!(list, modgens::Dict{Module, Vector{Method}}, mi::MethodInstan
123123 # Anonymous function, wrap in an `isdefined`
124124 prefix = " isdefined($mmod , Symbol(\" $mname \" )) && "
125125 fstr = " getfield($mmod , Symbol(\" $mname \" ))" # this is universal, var is Julia 1.3+
126- return add_if_evals!(list, topmod, fstr, paramrepr, tt; prefix= prefix , check_eval = check_eval , time= time )
126+ return add_if_evals!(list, topmod, fstr, paramrepr, tt; prefix, check_eval, time, suppress_time )
127127 end
128- return add_if_evals!(list, topmod, reprcontext(topmod, p), paramrepr, tt, check_eval = check_eval , time= time )
128+ return add_if_evals!(list, topmod, reprcontext(topmod, p), paramrepr, tt; check_eval, time, suppress_time )
129129end
130130
131131function handle_kwbody(topmod:: Module , m:: Method , paramrepr, tt, fstr= " fbody" ; check_eval = true )
@@ -195,11 +195,15 @@ Adds the precompilation statements only if they can be evaled. It uses [`can_eva
195195
196196In some cases, you may want to bypass this function by passing `check_eval=true` to increase the snooping performance.
197197"""
198- function add_if_evals!(pclist, mod:: Module , fstr, params, tt; prefix = " " , check_eval:: Bool = true , time= nothing )
198+ function add_if_evals!(pclist, mod:: Module , fstr, params, tt; prefix = " " , check_eval:: Bool = true , time= nothing , suppress_time :: Bool = false )
199199 ttstr = tupletypestring(fstr, params)
200200 can, exc = can_eval(mod, ttstr, check_eval)
201201 if can
202- push!(pclist, append_time(prefix* wrap_precompile(ttstr), time))
202+ str = prefix* wrap_precompile(ttstr)
203+ if ! suppress_time
204+ str = append_time(str, time)
205+ end
206+ push!(pclist, str)
203207 return true
204208 else
205209 @debug " Module $mod : skipping $tt due to eval failure" exception= exc _module= mod _file= " precompile_$mod .jl"
0 commit comments