SciML / EasyModelAnalysis.jl

High level functions for analyzing the output of simulations
MIT License
79 stars 13 forks source link

`IndexKeyMap` #192

Open chriselrod opened 1 year ago

chriselrod commented 1 year ago

This PR includes #191.

With the PR:

julia> @benchmark loglikelihood($model, $rp)
BenchmarkTools.Trial: 9095 samples with 1 evaluation.
 Range (min … max):   84.046 μs …  13.707 ms  ┊ GC (min … max):  0.00% … 97.32%
 Time  (median):      91.796 μs               ┊ GC (median):     0.00%
 Time  (mean ± σ):   107.322 μs ± 315.849 μs  ┊ GC (mean ± σ):  10.79% ±  3.76%

    ▂▄██▄▁                                                       
  ▁▄██████▇▅▄▄▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  84 μs            Histogram: frequency by time          167 μs <

 Memory estimate: 75.25 KiB, allocs estimate: 486.

Master is around 400us, or maybe around 200us with the latest Unityper.

codecov[bot] commented 1 year ago

Codecov Report

Merging #192 (d7f6e71) into main (38a8eaf) will decrease coverage by 2.66%. The diff coverage is 80.29%.

@@            Coverage Diff             @@
##             main     #192      +/-   ##
==========================================
- Coverage   81.77%   79.11%   -2.66%     
==========================================
  Files           7        8       +1     
  Lines         439      613     +174     
==========================================
+ Hits          359      485     +126     
- Misses         80      128      +48     
Impacted Files Coverage Δ
src/EasyModelAnalysis.jl 100.00% <ø> (ø)
src/datafit.jl 76.51% <76.10%> (+32.07%) :arrow_up:
src/ensemble.jl 90.47% <86.66%> (-9.53%) :arrow_down:
src/keyindexmap.jl 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

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

chriselrod commented 1 year ago

We're allocating over 10_000 times as much memory as needed for the returned objects:

julia> sol2 = @time solve(fit_enprob; saveat = t_forecast);
717.090530 seconds (5.89 G allocations: 865.902 GiB, 27.12% gc time)

so performance is dreadful. Only 27% GC time is a surprisingly good showing from the GC (on Julia 1.9).