Closed IanButterworth closed 2 years ago
I believe this setup, with imfilter! and symmetric should be allocation-free/minimal?
imfilter!
symmetric
Below uses the new allocation profiler in julia 1.8
julia> img1 = rand(Float32, 1000, 1000); julia> img2 = similar(img1); julia> kern = KernelFactors.IIRGaussian((2.0,2.0)); julia> @time imfilter!(img2, img1, kern, "symmetric"); 1.017254 seconds (2.70 M allocations: 144.354 MiB, 3.17% gc time, 97.60% compilation time) julia> @time imfilter!(img2, img1, kern, "symmetric"); 0.017806 seconds (1.03 k allocations: 7.768 MiB) julia> using Profile, PProf julia> Profile.Allocs.@profile sample_rate=0.5 imfilter!(img2, img1, KernelFactors.IIRGaussian((2.0,2.0)), "symmetric"); julia> PProf.Allocs.pprof(from_c = false)
cc. @johnnychen94
Not sure what's going on here. One small point, you get substantially better performance with kern = KernelFactors.IIRGaussian(Float32, (2.0,2.0)); (the images are Float32 so...)
kern = KernelFactors.IIRGaussian(Float32, (2.0,2.0));
I believe this setup, with
imfilter!
andsymmetric
should be allocation-free/minimal?Below uses the new allocation profiler in julia 1.8
cc. @johnnychen94