Open chrhck opened 1 year ago
This might be a few months late, but I had the same problem: I want to resample many short signals with a real-valued resampling rate, for which the filter is quite long (~37k samples) and takes a while to compute. If the rate is constant, you can compute the filter once, and provide it as an argument to resample
:
julia> s = rand(ComplexF32, 42000);
julia> ratio = 1/32.2;
julia> @time resample(s, ratio);
0.025392 seconds (37.42 k allocations: 2.936 MiB)
julia> @time f = resample_filter(ratio);
0.023044 seconds (37.38 k allocations: 1.426 MiB)
julia> @time resample(s, ratio, f);
0.002592 seconds (34 allocations: 1.510 MiB)
Note that this only helps because the output length is significantly shorter than the filter length -- if s
was much longer, or if ratio
wasn't as small, the difference wouldn't be as significant.
Should this be mentioned in the documentation? resample_filter
is currently undocumented, but it's exported, so it doesn't look like an internal function that the user should avoid.
I also have found resampling to be a bottleneck in some processing and this helps. It would be great if resample_filter
was documented and made part of the API.
See also #506.
Hi all, I have a workflow which requires a lot of resampling. The default filter used in
resample
is currently a bottleneck in my workflow, where a lot of time is spent in evaluating the Kaiser window (more preceisely: https://specialfunctions.juliamath.org/stable/functions_list/#SpecialFunctions.besseli ) Any tips on how I can improve performance?