Skip to content

Commit

Permalink
Revert "Profile: Faster data dict lookup (JuliaLang#43805)" (JuliaLan…
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored and LilithHafner committed Mar 8, 2022
1 parent 50798e6 commit ed2d0d1
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,18 +349,15 @@ function getdict(data::Vector{UInt})
end

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

0 comments on commit ed2d0d1

Please sign in to comment.