-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kaiser
performance: use Bessels.jl?
#506
Comments
@oscardssmith Is Bessels.jl stable enough and in good shape for DSP.jl to rely upon? |
IMO Bessels.jl at this point is pretty stable. Nice to see a 10x improvement. You could probably get a little more by using |
@martinholters Would it be ok to add a dependency on Bessels.jl? |
Fine with me. |
anowacki
added a commit
to anowacki/DSP.jl
that referenced
this issue
Feb 18, 2024
Replace calls to `SpecialFunctions.besseli(0, ...)` with calls to `Bessels.besseli0(...)`, adding Bessels.jl (https://github.com/JuliaMath/Bessels.jl) as a dependency. When resampling signals with a very low or high arbitrary rate, the call to `Windows.kaiser` is what dominates. Profiling this, most of the time is taken up by the call to `SpecialFunctions.besseli`. This allocates, but also the computation is just fundamentally slow for these arguments. Replacing these calls with those to `Bessels.besseli0` gives a factor of 17 speedup when resampling a 1000-point random trace to a rate of 0.02. Closes JuliaDSP#506.
anowacki
added a commit
to anowacki/DSP.jl
that referenced
this issue
Feb 19, 2024
Replace calls to `SpecialFunctions.besseli(0, ...)` with calls to `Bessels.besseli0(...)`, adding Bessels.jl (https://github.com/JuliaMath/Bessels.jl) as a dependency. When resampling signals with a very low or high arbitrary rate, the call to `Windows.kaiser` is what dominates. Profiling this, most of the time is taken up by the call to `SpecialFunctions.besseli`. This allocates, but also the computation is just fundamentally slow for these arguments. Replacing these calls with those to `Bessels.besseli0` gives a factor of 17 speedup when resampling a 1000-point random trace to a rate of 0.02. Closes JuliaDSP#506.
anowacki
added a commit
to anowacki/DSP.jl
that referenced
this issue
Feb 19, 2024
Replace calls to `SpecialFunctions.besseli(0, ...)` with calls to `Bessels.besseli0(...)`, adding Bessels.jl (https://github.com/JuliaMath/Bessels.jl) as a dependency. When resampling signals with a very low or high arbitrary rate, the call to `Windows.kaiser` is what dominates. Profiling this, most of the time is taken up by the call to `SpecialFunctions.besseli`. This allocates, but also the computation is just fundamentally slow for these arguments. Replacing these calls with those to `Bessels.besseli0` gives a factor of 17 speedup when resampling a 1000-point random trace to a rate of 0.02. Closes JuliaDSP#506.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When resampling signals with a very low or high arbitrary rate, the call to
kaiser
is what dominates. Profiling this, it seems like most of the time here is taken up by the call toSpecialFunctions.besseli
. This allocates but also the computation is just fundamentally slow for these arguments.Using DSP v0.7.8:
However, I see that Bessels.jl aims to provide Bessel functions in pure Julia which are faster than SpecialFunctions.jl's, and as accurate.
Using the following version of
DSP.Windows.kaiser
which usesBessels.besseli
we get an 8-fold improvement in runtime for this particular signal length and resampling rate:If you are happy to add an extra dependency on Bessels.jl, and you feel it is stable enough to rely on in the future, then I would be happy to open a PR so long as this passes tests.
The text was updated successfully, but these errors were encountered: