JuliaImages / ImageFiltering.jl

Julia implementations of multidimensional array convolution and nonlinear stencil operations
Other
99 stars 51 forks source link

Reduce unnecessary allocations in `filtfft` #231

Closed BioTurboNick closed 2 years ago

BioTurboNick commented 2 years ago

Several intermediate steps in filtfft are allocating when they don't need to be.

Results of this change on one of my operations:

Before: 86.106 ms (200 allocations: 140.55 MiB) After: 72.876 ms (196 allocations: 113.27 MiB)

19% improvement in time, 24% improvement in allocation size.

codecov[bot] commented 2 years ago

Codecov Report

Merging #231 (0c537f0) into master (6b51789) will increase coverage by 0.23%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #231      +/-   ##
==========================================
+ Coverage   91.60%   91.84%   +0.23%     
==========================================
  Files          11       11              
  Lines        1513     1594      +81     
==========================================
+ Hits         1386     1464      +78     
- Misses        127      130       +3     
Impacted Files Coverage Δ
src/imfilter.jl 92.10% <100.00%> (+0.32%) :arrow_up:
src/border.jl 92.93% <0.00%> (-0.17%) :arrow_down:
src/extrema.jl 100.00% <0.00%> (ø)
src/kernel.jl 99.23% <0.00%> (+0.02%) :arrow_up:
src/utils.jl 88.05% <0.00%> (+0.18%) :arrow_up:
src/kernelfactors.jl 91.25% <0.00%> (+0.27%) :arrow_up:
src/mapwindow.jl 86.90% <0.00%> (+0.46%) :arrow_up:
src/borderarray.jl 93.33% <0.00%> (+0.74%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6b51789...0c537f0. Read the comment docs.

timholy commented 2 years ago

Thanks @BioTurboNick!