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

reduce allocations in dims_howmany #269

Merged
merged 9 commits into from
Apr 12, 2023
Merged

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Mar 28, 2023

This reduces some unnecessary allocations in dims_howmany. This may be reduced further by using StaticArrays, but that's a separate discussion as it'll increase the load time.

On master

julia> X = rand(100, 100);

julia> @btime FFTW.dims_howmany($X, $X, $(collect(size(X))), 1)
  689.000 ns (21 allocations: 1.59 KiB)
([100; 1; 1;;], [100; 100; 100;;])

This PR
Updated after e15a9b8

julia> @btime FFTW.dims_howmany($X, $X, size($X), 1);
  73.707 ns (2 allocations: 160 bytes)

@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Patch coverage: 96.00% and project coverage change: +1.59 🎉

Comparison is base (82a99dc) 69.09% compared to head (270c27a) 70.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
+ Coverage   69.09%   70.68%   +1.59%     
==========================================
  Files           5        5              
  Lines         495      522      +27     
==========================================
+ Hits          342      369      +27     
  Misses        153      153              
Impacted Files Coverage Δ
src/fft.jl 68.75% <96.00%> (+2.16%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/fft.jl Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

Thanks, this is ancient code that needed a fresh look.

There's nothing StaticArrays can do that couldn't be done with tuples, perhaps with slightly more code, and I'd prefer to avoid the StaticArrays dependency.

@jishnub
Copy link
Contributor Author

jishnub commented Mar 28, 2023

Thanks! I've updated it now, and all the unnecessary allocations are now avoided if region is an Int or a Tuple

@jishnub
Copy link
Contributor Author

jishnub commented Mar 29, 2023

This should be ready now

@jishnub
Copy link
Contributor Author

jishnub commented Apr 3, 2023

Gentle bump

@jishnub
Copy link
Contributor Author

jishnub commented Apr 3, 2023

#266 should ideally have been v1.7.0 instead of v1.6.1 as it is mildly breaking, so I'm bumping the version in this PR instead.

@jishnub
Copy link
Contributor Author

jishnub commented Apr 11, 2023

Gentle bump @stevengj

@stevengj stevengj merged commit e4a00b1 into JuliaMath:master Apr 12, 2023
@stevengj
Copy link
Member

LGTM

@jishnub jishnub deleted the dims_howmany branch April 12, 2023 23:27
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

Successfully merging this pull request may close these issues.

None yet

2 participants