cgarling / StarFormationHistories.jl

Fitting astrophysical star formation histories via CMD modelling.
MIT License
3 stars 0 forks source link

Interpolation performance #2

Closed cgarling closed 1 year ago

cgarling commented 1 year ago

A main source of heap allocations seems to be that when the interpolants from Interpolations.jl are constructed with vector-valued data, they return vectors which allocate on the heap and there does not seem to be an in-place evaluation method. If we instead (probably in ingest_mags?) convert the mags (Vector{Vector{<:Real}}) to a Vector{StaticArrays.SVector{N, <:Real}} we can greatly reduce heap allocation and potentially improve the speed as well; an initial test with 2 filters demonstrates a change from 256 bytes heap and 105ns evaluation to 48 bytes heap and 26ns evaluation. Our entire loop iteration timing for the Chabrier2001LogNormal IMF is ~200 ns so this could be a significant savings.

cgarling commented 1 year ago

This has been implemented for the methods in simulate.jl