-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
MRE:
julia> methods(show);
julia> length(methods(show))
304
julia> @time methods(show);
0.000278 seconds (966 allocations: 46.531 KiB)julia@master
julia> methods(show);
julia> length(methods(show))
314
julia> @time methods(show);
0.022454 seconds (14.80 k allocations: 812.578 KiB)The profiling shows most of the time is spent in _methods_by_ftype, and I guess #35983 might be the source of this.
Well, I'm not sure the performance for methods is critical; I found this problem just because Juno's completions are much slower than before when using Julia built from master, and profiling shows that this line calling methods is the source of the performance regression:
https://github.com/JunoLab/Atom.jl/blob/c751731bd488db815110ed7771b7f313d8b92116/src/utils.jl#L268
ismacro(f::Function) = startswith(string(methods(f).mt.name), "@")Now I found changing this line into
function ismacro(@nospecialize(f::FT)) where {FT<:Function}
isdefined(FT, :name) || return false
tn = FT.name::Core.TypeName
return occursin('@', string(tn.name))
endgets rid of the performance regression anyway, so I'm okay with it if the slowness of methods can't be helped in order to circumvent the latency issues.
Metadata
Metadata
Assignees
Labels
No labels