In Julia 1.11, looking to understand sources of type instability, I profile my code:
... # "diffed_residual", and some variables defined here by a large code base:
# no MVE
using ProfileView
using Profile
out = diffed_residual(beam; X,U=(SVector{0,𝕣}(),),A,t,SP)
Profile.clear()
Profile.@profile for i=1:30000
local out = diffed_residual(beam; X,U=(SVector{0,𝕣}(),),A,t,SP)
end
ProfileView.view(fontsize=30);
I get a good flamegraph, with some red color (type instability) I want to know more about. I can click on some functions and in the REPL type warntype_last()
and obtain type-inferred code: perfect.
But clicking on other functions in the same flamegraph, then invoking warntype_last()
I get
julia> C:\Users\philippem\.julia\dev\Muscade\src\Taylor.jl:181, MethodInstance for apply{:compose}(::var"#439#440"{:compose, EulerBeam3D{BeamCrossSection, false}}, ::SVector{6, ∂ℝ{2, 12, ∂ℝ{1, 12, Float64}}})
julia> warntype_last()
ERROR: type UnionAll has no field instance
Stacktrace:
[1] getproperty(x::Type, f::Symbol)
@ Base .\Base.jl:43
[2] call_type(tt::Type)
@ MethodAnalysis C:\Users\philippem\.julia\packages\MethodAnalysis\1NgHK\src\MethodAnalysis.jl:44
[3] warntype_clicked(io::Base.TTY; kwargs::@Kwargs{})
@ ProfileView C:\Users\philippem\.julia\packages\ProfileView\eDYNi\src\ProfileView.jl:76
[4] warntype_clicked(io::Base.TTY)
@ ProfileView C:\Users\philippem\.julia\packages\ProfileView\eDYNi\src\ProfileView.jl:70
[5] warntype_last(; kwargs::@Kwargs{})
@ ProfileView .\deprecated.jl:116
[6] warntype_last()
@ ProfileView .\deprecated.jl:113
[7] top-level scope
@ REPL[7]:1
This is distinct from the (understandable) error one gets when clicking on an inlined function.
Is this maybe a known bug of ProfileView.jl
? Or did I miss something?