SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
129 stars 95 forks source link

fix vector interpolation and remove unnecessary `@inbounds` #478

Closed oscardssmith closed 1 year ago

oscardssmith commented 1 year ago

This is a followup to https://github.com/SciML/SciMLBase.jl/pull/476 that fixes some typos and also fixes a bounds error. This also removes unnecessary @inbounds that don't improve performance.

Benchmark:

julia> using Sundials

julia> mutable struct precflags
           prec_used::Bool
           psetup_used::Bool
       end

julia> prob = DAEProblem(prob_dae_resrob.f, prob_dae_resrob.du0, prob_dae_resrob.u0,
           prob_dae_resrob.tspan,  precflags(false, false));

julia> sol = solve(prob, IDA());

#before
julia> @btime sol(85000)
  3.474 μs (55 allocations: 4.67 KiB)

julia> @btime sol(1000:1000:90000);
  283.921 μs (4776 allocations: 420.81 KiB)

#after
julia> @btime sol(85000)
  3.450 μs (55 allocations: 4.67 KiB)

julia> @btime sol(1000:1000:90000);
  284.034 μs (4776 allocations: 420.81 KiB)
codecov[bot] commented 1 year ago

Codecov Report

Merging #478 (5c619ce) into master (0bffe3e) will decrease coverage by 1.63%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #478      +/-   ##
==========================================
- Coverage   56.28%   54.65%   -1.63%     
==========================================
  Files          47       47              
  Lines        3587     3586       -1     
==========================================
- Hits         2019     1960      -59     
- Misses       1568     1626      +58     
Files Changed Coverage Δ
src/interpolation.jl 33.20% <50.00%> (ø)

... and 10 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more