Closed stillyslalom closed 4 years ago
Buffer allocation should be < a dozen individual allocations. This merits detailed investigation, though I don't have time right now. (Profiling does not reveal dynamic dispatch, which was my first guess.)
This seems mostly due to the fact that Julia can't create wrappers to heap-allocated objects on the stack: https://stackoverflow.com/questions/47590839/unexpected-memory-allocation-when-using-array-views-julia/47607539#47607539. I don't think there's a good way of dealing with this now, other than wait for Julia to fix this.
While it would be nice to avoid the GC, it's worth noting that the performance is quite good, around 2ns/array element. Given that your filters nominally have 27 elements (9 once you take advantage of separability) and thus it's a minimum of 9 adds and multiplies/array element, that's pretty awesome.
I have a time-series of volumetric 'images' from which I need to calculate gradients, and each calculation spends a solid fraction of its runtime on GC:
I'd like to provide preallocated arrays for both output and padding.