-
Notifications
You must be signed in to change notification settings - Fork 56
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
Function ports
is not type stable.
#803
Comments
The function
Then
outputs On the other hand,
outputs |
Thanks for the catch here. According to julia> @code_warntype parts(wd, :Port)
MethodInstance for ACSets.ACSetInterface.parts(::UntypedUWD, ::Symbol)
from parts(acs, type) @ ACSets.ACSetInterface ~/.julia/packages/ACSets/1pqJM/src/ACSetInterface.jl:36
Arguments
#self#::Core.Const(ACSets.ACSetInterface.parts)
acs::UntypedUWD
type::Symbol
Body::Any
1 ─ nothing
│ %2 = ACSets.ACSetInterface.nparts(acs, type)::Any
│ %3 = (1:%2)::Any
└── return %3
julia> @code_warntype nparts(wd, :Port)
MethodInstance for ACSets.ACSetInterface.nparts(::UntypedUWD, ::Symbol)
from nparts(acs::SimpleACSet, type::Symbol) @ ACSets.DenseACSets ~/.julia/packages/ACSets/1pqJM/src/DenseACSets.jl:341
Arguments
#self#::Core.Const(ACSets.ACSetInterface.nparts)
acs::UntypedUWD
type::Symbol
Body::Any
1 ─ nothing
│ %2 = Base.getproperty(acs, :parts)::ACSets.LVectors.LVector{(:Box, :Port, :OuterPort, :Junction), Int64}
│ %3 = Base.getindex(%2, type)::Any
└── return %3 |
Full MWE: using Catlab.WiringDiagrams
using Catlab.CategoricalAlgebra
wd = singleton_diagram(UntypedUWD, 1000000);
@code_warntype nparts(wd, :Port) I tested on Catlab 14 and 13 so this isn't a (recent) regression. with the ACSets refactor. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following two functions:
Then, on my machine,
outputs
0.051219 seconds (3.00 M allocations: 70.801 MiB)
.On the other hand,
outputs
0.004928 seconds (17 allocations: 9.782 MiB)
.The text was updated successfully, but these errors were encountered: