@@ -194,7 +194,7 @@ function handle_kwbody(topmod::Module, m::Method, paramrepr, tt, fstr="fbody")
194
194
end
195
195
196
196
function parcel (tinf:: AbstractVector{Tuple{Float64,Core.MethodInstance}} ; subst= Vector {Pair{String, String}} (), blacklist= String[])
197
- pc = Dict {Symbol, Vector {String}} () # output
197
+ pc = Dict {Symbol, Set {String}} () # output
198
198
modgens = Dict {Module, Vector{Method}} () # methods with generators in a module
199
199
mods = OrderedSet {Module} () # module of each parameter for a given method
200
200
for (t, mi) in reverse (tinf)
@@ -216,7 +216,7 @@ function parcel(tinf::AbstractVector{Tuple{Float64,Core.MethodInstance}}; subst=
216
216
# If we haven't yet started the list for this module, initialize
217
217
topmodname = nameof (topmod)
218
218
if ! haskey (pc, topmodname)
219
- pc[topmodname] = String[]
219
+ pc[topmodname] = Set { String} ()
220
220
# For testing our precompile directives, we might need to have lookup available
221
221
if VERSION >= v " 1.4.0-DEV.215" && topmod != = Core && ! isdefined (topmod, :__bodyfunction__ )
222
222
Core. eval (topmod, lookup_kwbody_ex)
@@ -298,7 +298,7 @@ function parcel(tinf::AbstractVector{Tuple{Float64,Core.MethodInstance}}; subst=
298
298
add_if_evals! (pc[topmodname], topmod, reprcontext (topmod, p), paramrepr, tt)
299
299
end
300
300
end
301
- return pc
301
+ return Dict (mod => collect (lines) for (mod, lines) in pc)
302
302
end
303
303
304
304
"""
@@ -312,7 +312,7 @@ pcI = ["good","bad","hi","bye","no"]
312
312
SnoopCompile.blacklist_remover!(pcI, blacklist)
313
313
```
314
314
"""
315
- function blacklist_remover! (pcI, blacklist)
315
+ function blacklist_remover! (pcI:: AbstractVector , blacklist)
316
316
idx = Int[]
317
317
for (iLine, line) in enumerate (pcI)
318
318
if any (occursin .(blacklist, line))
@@ -322,3 +322,14 @@ function blacklist_remover!(pcI, blacklist)
322
322
deleteat! (pcI, idx)
323
323
return pcI
324
324
end
325
+
326
+ function blacklist_remover! (pcI:: AbstractSet , blacklist)
327
+ # We can't just use `setdiff!` because this is a substring search
328
+ todelete = Set {eltype(pcI)} ()
329
+ for line in pcI
330
+ if any (occursin .(blacklist, line))
331
+ push! (todelete, line)
332
+ end
333
+ end
334
+ return setdiff! (pcI, todelete)
335
+ end
0 commit comments