From c963859017e11e1e7b0ca204b8d9bd336eeba508 Mon Sep 17 00:00:00 2001 From: fjebaker Date: Sat, 8 Jun 2024 14:25:31 +0100 Subject: [PATCH] fix: enormously reduce allocations in composite disc tracing --- src/tracing/radiative-transfer-problem.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tracing/radiative-transfer-problem.jl b/src/tracing/radiative-transfer-problem.jl index e10bfb3f..353b58d2 100644 --- a/src/tracing/radiative-transfer-problem.jl +++ b/src/tracing/radiative-transfer-problem.jl @@ -65,20 +65,21 @@ function _intensity_delta( m, x, k::AbstractArray{T}, - geometry::CompositeGeometry, + geometry::CompositeGeometry{K,D}, within, I, ν₀, r_isco, λ, -) where {T} - total::T = zero(T) - for i in eachindex(geometry.geometry) - total += _intensity_delta( +) where {T,K,D} + indices = (length(D.parameters)...,) + sum(zip(geometry.geometry, indices)) do args + geom, i = args + _intensity_delta( m, x, k, - geometry.geometry[i], + geom, within, I, ν₀, @@ -87,7 +88,6 @@ function _intensity_delta( index = i, ) end - total end function _intensity_delta(