Open jw3126 opened 5 years ago
I'll have a look but I'm not sure there is anything I can do about this. The only suggestion I can give you is to use cuhre
instead of vegas
as the former is more accurate and requires fewer evaluations (thus fewer allocations):
julia> using Cuba, BenchmarkTools
julia> @btime cuhre((x, f) -> f[1] = x[1])
25.231 μs (784 allocations: 36.89 KiB)
Component:
1: 0.5 ± 4.291960664289122e-15 (prob.: 0.0)
Integrand evaluations: 195
Fail: 0
Number of subregions: 2
julia> @btime vegas((x, f) -> f[1] = x[1])
21.588 ms (928004 allocations: 42.48 MiB)
Component:
1: 0.4999999506146127 ± 4.969630652405548e-5 (prob.: 2.559630372933608e-5)
Integrand evaluations: 232000
Fail: 0
Number of subregions: 0
Cuba produces a lot of allocations, 4 per iteration in the example below. Is there a way to avoid this?