Closed
Description
I don't really know where to report this, so please move it somewhere else.
I had a brief look at load times using Julia v1.9.0-rc1:
julia> @time_imports using OrdinaryDiffEq
[...]
416.1 ms TruncatedStacktraces 93.53% compilation time (63% recompilation)
[...]
237.7 ms SciMLBase 4.98% compilation time (100% recompilation)
[...]
This made me suspicious. Thus, I wanted to check whether invalidations are the reason but ran into some problems:
julia> using Pkg; Pkg.activate(temp=true); Pkg.add("SciMLBase")
[...]
[0bca4576] + SciMLBase v1.89.0
[...]
[781d530d] + TruncatedStacktraces v1.1.0
[...]
julia> using SnoopCompileCore; invalidations = @snoopr(using SciMLBase); using SnoopCompile
julia> length(uinvalidated(invalidations))
2113
julia> trees = invalidation_trees(invalidations)
5-element Vector{SnoopCompile.MethodInvalidations}:
Error showing value of type Vector{SnoopCompile.MethodInvalidations}:
ERROR: UndefVarError: `isinplace` not defined
Some of the types have been truncated in the stacktrace for improved reading. To emit complete information
in the stack trace, evaluate `TruncatedStacktraces.VERBOSE[] = true` and re-run the code.
Stacktrace:
[1] show(io::IOContext{IOBuffer}, t::
SYSTEM (REPL): showing an error caused an error
ERROR: UndefVarError: `isinplace` not defined
Some of the types have been truncated in the stacktrace for improved reading. To emit complete information
in the stack trace, evaluate `TruncatedStacktraces.VERBOSE[] = true` and re-run the code.
Stacktrace:
[1] show(io::IOContext{IOBuffer}, t::
SYSTEM (REPL): caught exception of type UndefVarError while trying to handle a nested exception; giving up
So there are indeed quite a lot of invalidations. However, it's hard to see the full report since something fails. Verbose printing doesn't help:
julia> Pkg.add("TruncatedStacktraces"); using TruncatedStacktraces; TruncatedStacktraces.VERBOSE[] = true
julia> trees[5]
inserting Error showing value of type SnoopCompile.MethodInvalidations:
ERROR: UndefVarError: `uType` not defined
Stacktrace:
[1] show(io::IOContext{IOBuffer}, t::
SYSTEM (REPL): showing an error caused an error
ERROR: UndefVarError: `uType` not defined
Stacktrace:
[1] show(io::IOContext{IOBuffer}, t::
SYSTEM (REPL): caught exception of type UndefVarError while trying to handle a nested exception; giving up
I suspect TruncatedStacktraces.jl to play a role here, though:
julia> trees[5].method.name
:show
julia> trees[5].backedges
2-element Vector{SnoopCompile.InstanceNode}:
MethodInstance for show(::IOContext{IOBuffer}, ::Type) at depth 0 with 107 children
MethodInstance for show(::IOBuffer, ::Type) at depth 0 with 3064 children
The first four methods do not have many invalidations and can be displayed without problems:
julia> trees[1]
inserting unique(x::FillArrays.AbstractFill{T}) where T @ FillArrays ~/.julia/packages/FillArrays/xqile/src/FillArrays.jl:555 invalidated:
backedges: 1: superseding unique(A::AbstractArray; dims) @ Base multidimensional.jl:1640 with MethodInstance for unique(::AbstractArray) (1 children)
julia> trees[2]
inserting Base.IteratorSize(::Type{<:FillArrays.AbstractFill{T, N, Axes}}) where {T, N, Axes} @ FillArrays ~/.julia/packages/FillArrays/xqile/src/FillArrays.jl:64 invalidated:
backedges: 1: superseding Base.IteratorSize(::Type) @ Base generator.jl:94 with MethodInstance for Base.IteratorSize(::Type{<:AbstractString}) (5 children)
87 mt_cache
julia> trees[3]
inserting print_matrix_row(io::IO, X::Union{FillArrays.AbstractFill{<:Any, 1}, FillArrays.AbstractFill{<:Any, 2}, FillArrays.RectDiagonal, LinearAlgebra.AbstractTriangular{<:Any, <:FillArrays.AbstractFill{<:Any, 2}}, LinearAlgebra.Diagonal{<:Any, <:FillArrays.AbstractFill{<:Any, 1}}}, A::Vector, i::Integer, cols::AbstractVector, sep::AbstractString, idxlast::Integer) @ FillArrays ~/.julia/packages/FillArrays/xqile/src/FillArrays.jl:688 invalidated:
backedges: 1: superseding print_matrix_row(io::IO, X::AbstractVecOrMat, A::Vector, i::Integer, cols::AbstractVector, sep::AbstractString, idxlast::Integer) @ Base arrayshow.jl:97 with MethodInstance for Base.print_matrix_row(::IOContext{Base.TTY}, ::AbstractVecOrMat, ::Vector{Tuple{Int64, Int64}}, ::Int64, ::Vector{Int64}, ::String, ::Int64) (9 children)
julia> trees[4]
inserting broadcasted(::Base.Broadcast.DefaultArrayStyle{N}, op, r::FillArrays.AbstractFill{T, N}) where {T, N} @ FillArrays ~/.julia/packages/FillArrays/xqile/src/fillbroadcast.jl:78 invalidated:
mt_backedges: 1: signature broadcasted(::S, f, args...) where S<:BroadcastStyle @ Base.Broadcast broadcast.jl:1319 (formerly broadcasted(::S, f, args...) where S<:BroadcastStyle @ Base.Broadcast broadcast.jl:1319) triggered MethodInstance for Base.Broadcast.broadcasted(::typeof(esc), ::Any) (20 children)
66 mt_cache
Metadata
Metadata
Assignees
Labels
No labels