Open MarcMush opened 3 months ago
usually it’s better to write these non-recursively:
function Base.getproperty(p::B, name::Symbol)
if hasfield(B, name)
getfield(p, name)
else
getproperty(getfield(p, :a) name)
end
end
Here I use getfield
in the second branch also.
indeed this non-recursive function works efficiently like in 1.9
with this code that does some "julian inheritance":
julia 1.9.4: 2.2 ns julia 1.10.4: 7.9 ns julia 1.11.0-rc1: 7.5 ns
the
@code_typed
is very similar, the only difference being thatBase._fieldindex_nothrow
is not inlined in 1.10.removing the
@noinline
from_fieldindex_nothrow
seems to help slightly but not completely solve the issueThe big difference is in
@code_llvm