I was hoping I could be helped in understanding the following concept. The code is a bit too long to provide a clean MWE, but I am trying to understanding the following:
julia> @btime integrand_B1_new($y,$params,$ygrid,$W_grid_F1_inv,$result_init) 808.978 ns (0 allocations: 0 bytes) 0.7020207253704929 fun1(y) = integrand_B1_new(y,params,ygrid,W_grid_F1_inv, result_init) julia> @btime fun1($y) 876.345 ns (2 allocations: 32 bytes) 0.7020207253704929
Is there a way to write the collapsed function
fun1(y) in a way such that it does not allocate? I make calls to fun1(y) in a function like
quadgk() to interpolate some intergrals over a grid. For example, I use
quadgk(fun1, min, max) and over a few hundred (or thousand) points over the grid, the calls to
fun1(y) add up quite a bit.
Conceptually understanding what may be going on would be the most helpful.