Skip to content

Commit

Permalink
use map!
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 14, 2022
1 parent 2cf728a commit f999b7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ 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)
foreach(ip -> dict[UInt64(ip)] = StackFrame[], unique_data_itr) # preallocate
@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)
map!(first, dict[UInt64(ip)], stn)
end
end
return dict
Expand Down

0 comments on commit f999b7a

Please sign in to comment.