JuliaApproximation / ApproxFunBase.jl

Core functionality of ApproxFun
MIT License
12 stars 13 forks source link

Fix type instability in constructors.jl #621

Closed jondeuce closed 5 months ago

jondeuce commented 5 months ago

Small bugfix, just missing a type parameter in zeros.

Before this PR:

julia> using ApproxFunBase, ApproxFun

julia> @code_warntype Fun(exp, Chebyshev(big(-1.0) .. big(1.0)))
MethodInstance for Fun(::typeof(exp), ::Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat})
  from Fun(f, d::Space) @ ApproxFunBase ~/.julia/dev/ApproxFunBase/src/constructors.jl:225
Arguments
  #self#::Type{Fun}
  f::Core.Const(exp)
  d::Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}
Body::Union{Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, Float64, Vector{Float64}}, Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, BigFloat, Vector{BigFloat}}}
1 ─ %1 = ApproxFunBase.default_Fun(f, d)::Union{Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, Float64, Vector{Float64}}, Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, BigFloat, Vector{BigFloat}}}
└──      return %1

After this PR:

julia> @code_warntype Fun(exp, Chebyshev(big(-1.0) .. big(1.0)))
MethodInstance for Fun(::typeof(exp), ::Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat})
  from Fun(f, d::Space) @ ApproxFunBase ~/.julia/dev/ApproxFunBase/src/constructors.jl:225
Arguments
  #self#::Type{Fun}
  f::Core.Const(exp)
  d::Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}
Body::Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, BigFloat, Vector{BigFloat}}
1 ─ %1 = ApproxFunBase.default_Fun(f, d)::Fun{Chebyshev{IntervalSets.ClosedInterval{BigFloat}, BigFloat}, BigFloat, Vector{BigFloat}}
└──      return %1
codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (c676431) 70.71% compared to head (38c9f11) 75.08%. Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #621 +/- ## ========================================== + Coverage 70.71% 75.08% +4.36% ========================================== Files 80 80 Lines 8398 8437 +39 ========================================== + Hits 5939 6335 +396 + Misses 2459 2102 -357 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jishnub commented 5 months ago

Thanks!