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

subtypes function runs very slowly #38079

Open
epatters opened this issue Oct 17, 2020 · 0 comments
Open

subtypes function runs very slowly #38079

epatters opened this issue Oct 17, 2020 · 0 comments
Labels
performance Must go faster types and dispatch Types, subtyping and method dispatch

Comments

@epatters
Copy link

The short version is this:

julia> @time subtypes(AbstractVector);
  0.136176 seconds (172.76 k allocations: 9.653 MiB)

julia> @time subtypes(AbstractVector);
  0.011419 seconds (6.24 k allocations: 879.953 KiB)

julia> import Catlab

julia> @time subtypes(AbstractVector);
 35.150647 seconds (1.54 M allocations: 126.430 MiB, 0.25% gc time)

julia> @time subtypes(AbstractVector);
  7.711600 seconds (169.09 k allocations: 16.685 MiB, 0.31% gc time)

julia> @time subtypes(AbstractVector);
  8.123479 seconds (169.09 k allocations: 16.685 MiB)

Context: The Documenter.jl builds for Catlab.jl and its dependers have been running very slowly for a while now. I finally tracked this down to the subtypes function, which Documenter calls once per Markdown element in the ExpandTemplates step. Issue JuliaDocs/Documenter.jl#1438 has been filed there (see also the older JuliaDocs/Documenter.jl#1261).

Unfortunately I cannot say what part of Catlab and/or Julia is responsible but I can point in the general direction. The problem arose during the development of data structures for C-sets, defined in the file CSetDataStructures.jl. This file makes heavy use of @generated methods for complex parameterized data types. My guess is that something related to that is causing the slowdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

2 participants