Closed fjebaker closed 1 year ago
using Gradus
m = KerrMetric(M = 1.0, a = 0.6)
u = @SVector [0.0, 1000.0, deg2rad(60), 0.0]
d = GeometricThinDisc(0.0, 100.0, π/2)
begin
GC.gc()
println("Start...")
α, β = @time impact_parameters_for_radius(m, u, d, 5.0, N=1000)
""
end
# old: N = 1000
# 1.296828 seconds (1.05 M allocations: 245.828 MiB)
# old: N = 10000
# 12.974839 seconds (10.60 M allocations: 2.422 GiB, 1.63% gc time)
# new: N = 1000
# 1.279600 seconds (334.35 k allocations: 69.610 MiB)
# new: N = 10000
# 12.846616 seconds (3.37 M allocations: 701.538 MiB)
This might start getting quite confusing, but there is now a new ensemble method in Gradus which reuses integrators provided only the endpoints of the geodesic are needed --
EnsembleEndpointThreads
. This saves a considerable number of allocations, as can be seen above.The same principle could also be used anywhere where the full solutions aren't required, such as in the precision integrators -- instead of setting up a full solution again, we just
init
andreinit
as needed.I will add that to the next PR to improve those methods.
Is a step towards #82 👍