Skip to content

Commit bff3eb6

Browse files
authored
Revert "Profile: Faster data dict lookup (#43805)" (#43814)
1 parent 7ab26e0 commit bff3eb6

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,15 @@ function getdict(data::Vector{UInt})
349349
end
350350

351351
function getdict!(dict::LineInfoDict, data::Vector{UInt})
352-
# we don't want metadata here as we're just looking up ips
353-
unique_data_itr = Iterators.unique(has_meta(data) ? strip_meta(data) : data)
354-
foreach(ip -> dict[UInt64(ip)] = StackFrame[], unique_data_itr)
355-
@sync for ip in unique_data_itr
356-
Threads.@spawn begin
357-
st = lookup(convert(Ptr{Cvoid}, ip))
358-
# To correct line numbers for moving code, put it in the form expected by
359-
# Base.update_stackframes_callback[]
360-
stn = map(x->(x, 1), st)
361-
try Base.invokelatest(Base.update_stackframes_callback[], stn) catch end
362-
dict[UInt64(ip)] = map(first, stn)
363-
end
352+
for ip in data
353+
# Lookup is expensive, so do it only once per ip.
354+
haskey(dict, UInt64(ip)) && continue
355+
st = lookup(convert(Ptr{Cvoid}, ip))
356+
# To correct line numbers for moving code, put it in the form expected by
357+
# Base.update_stackframes_callback[]
358+
stn = map(x->(x, 1), st)
359+
try Base.invokelatest(Base.update_stackframes_callback[], stn) catch end
360+
dict[UInt64(ip)] = map(first, stn)
364361
end
365362
return dict
366363
end

0 commit comments

Comments
 (0)