Skip to content
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

cheb2ultra seems unreasonably slow #204

Open
jishnub opened this issue Mar 26, 2023 · 2 comments
Open

cheb2ultra seems unreasonably slow #204

jishnub opened this issue Mar 26, 2023 · 2 comments

Comments

@jishnub
Copy link
Member

jishnub commented Mar 26, 2023

julia> x = rand(1000);

julia> y1 = @btime FastTransforms.cheb2ultra($x, 2);
  24.224 ms (2 allocations: 7.98 KiB)

julia> y2 = @btime ApproxFunBase.mul_coefficients(Conversion(Chebyshev(), Ultraspherical(2)), $x);
  45.568 μs (13 allocations: 63.27 KiB)

julia> y1  y2
true
@MikaelSlevinsky
Copy link
Member

Almost all the time is spent on the plans. Good planning makes better execution.

julia> @btime cheb2ultra($x, 2);
  15.481 ms (2 allocations: 7.98 KiB)

julia> p = plan_cheb2ultra(x, 2);

julia> @btime $p*$x;
  204.918 μs (1 allocation: 7.94 KiB)

julia> p = plan_cheb2ultra(x, 1.9);

julia> @btime $p*$x;
  197.862 μs (1 allocation: 7.94 KiB)

BUT, the cheb2ultra plan doesn't specialize on integer lambda, which is a banded conversion.

@jishnub
Copy link
Member Author

jishnub commented Mar 27, 2023

Would it make sense to cache the plans, so that one only needs to compute then once for a specific combination of parameters? Something like an LRUCache could ensure that there's no explosion in the number of plans cached

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants