Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

methods seems to get 100x slower than in v1.5 #38059

Closed
aviatesk opened this issue Oct 16, 2020 · 2 comments
Closed

methods seems to get 100x slower than in v1.5 #38059

aviatesk opened this issue Oct 16, 2020 · 2 comments

Comments

@aviatesk
Copy link
Sponsor Member

aviatesk commented Oct 16, 2020

MRE:

julia@1.5.2

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))
end

gets 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.

@KristofferC
Copy link
Sponsor Member

Ref #36860, #38037

@JeffBezanson
Copy link
Sponsor Member

Yes this is a duplicate of #36860.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants