Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Construct LazyString in error paths for tridiag (#54648)
Similar to #54631, this would help reduce dynamic dispatches involved in concatenating a `String` and a `LazyString`. These show up in ```julia julia> @report_opt Tridiagonal(rand(1), rand(2), rand(1)) \ rand(2) [ Info: tracking Base ┌ Warning: skipping var"#sprint#594"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:107 to avoid parsing too much code └ @ Revise ~/.julia/packages/Revise/bAgL0/src/packagedef.jl:1092 ┌ Warning: skipping (::Base.var"#120#121")(io) @ Base strings/lazy.jl:84 to avoid parsing too much code └ @ Revise ~/.julia/packages/Revise/bAgL0/src/packagedef.jl:1092 ═════ 1 possible error found ═════ ┌ \(A::Tridiagonal{Float64, Vector{Float64}}, B::Vector{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/generic.jl:1132 │┌ lu(::Tridiagonal{Float64, Vector{Float64}}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/lu.jl:341 ││┌ lu(::Tridiagonal{Float64, Vector{Float64}}; kwargs::@kwargs{}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/lu.jl:341 │││┌ _lucopy(A::Tridiagonal{Float64, Vector{Float64}}, T::Type{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/lu.jl:351 ││││┌ copymutable_oftype(A::Tridiagonal{Float64, Vector{Float64}}, ::Type{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/LinearAlgebra.jl:463 │││││┌ similar(M::Tridiagonal{Float64, Vector{Float64}}, ::Type{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/tridiag.jl:603 ││││││┌ Tridiagonal(dl::Vector{Float64}, d::Vector{Float64}, du::Vector{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/tridiag.jl:520 │││││││┌ Tridiagonal{Float64, Vector{Float64}}(dl::Vector{Float64}, d::Vector{Float64}, du::Vector{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-5/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/tridiag.jl:477 ││││││││┌ string(::String, ::String, ::LazyString) @ Base ./strings/io.jl:189 │││││││││┌ print_to_string(::String, ::String, ::LazyString) @ Base ./strings/io.jl:148 ││││││││││┌ print(io::IOBuffer, s::LazyString) @ Base ./strings/io.jl:195 │││││││││││┌ iterate(s::LazyString) @ Base ./strings/lazy.jl:94 ││││││││││││┌ String(l::LazyString) @ Base ./strings/lazy.jl:83 │││││││││││││┌ sprint(::Base.var"#120#121"{LazyString}) @ Base ./strings/io.jl:107 ││││││││││││││┌ sprint(::Base.var"#120#121"{LazyString}; context::Nothing, sizehint::Int64) @ Base ./strings/io.jl:114 │││││││││││││││┌ (::Base.var"#120#121"{LazyString})(io::IOBuffer) @ Base ./strings/lazy.jl:85 ││││││││││││││││ runtime dispatch detected: print(io::IOBuffer, %16::Any)::Any │││││││││││││││└──────────────────── ``` Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Co-authored-by: Dilum Aluthge <dilum@aluthge.com> (cherry picked from commit 770a464)
- Loading branch information