Introduce the alloc_buf function to preallocate the BinaryMaxHeap buffer used in hcubature, and adapt the signature of hcubature to accept an optional buffer keyword argument (similar to what QuadGK currently provides).
This can be helpful when calling hcubature several times on similar functions:
Introduce the
alloc_buf
function to preallocate theBinaryMaxHeap
buffer used inhcubature
, and adapt the signature ofhcubature
to accept an optionalbuffer
keyword argument (similar to whatQuadGK
currently provides).This can be helpful when calling
hcubature
several times on similar functions:For more complex integrands or higher dimensions, the gain is usually minimal (but it reduces the allocations):