Closed daniellga closed 3 months ago
This would mean that every process_* call modifies the FFT struct, which causes trouble if the FFT is used by several threads in parallel. Only way to solve that is by using a mutex to prevent parallel calls. The api gets easier but it doesn't seem like a good trade-off to me :)
Can't an Arc
be used in this case alongside its COW properties? If the scratch buffer is being used by another thread it would automatically just clone the buffer instead.
That would be better. But then you give up control over when allocations happen, which is probably not acceptable in many real time applications.
Oh fair enough. Thanks for answering.
This is just a question. Since all
process_*
methods forFft
use a scratch buffer, be it a user input or one created internally, why not to store this buffer internally on the structs, simplifying the number of methods needed for the trait (process_with_scratch
would not be needed) and also assuring that everyprocess_*
use is reusing the same buffer as scratch?