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

Less alloc in TriggsSdika filtering (fix #243) #244

Merged
merged 2 commits into from
Feb 9, 2022
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Feb 8, 2022

Putting the string interpolation behind a @noinline is the key change,
but it doesn't hurt to hoist the range creation.

Of the few remaining allocations, about half will be fixed by
JuliaLang/julia#43990, as they are another
instance of JuliaLang/julia#35972

Putting the string interpolation behind a `@noinline` is the key change,
but it doesn't hurt to hoise the range creation.

Of the few remaining allocations, about half will be fixed by
JuliaLang/julia#43990, as they are another
instance of JuliaLang/julia#35972
@timholy
Copy link
Member Author

timholy commented Feb 8, 2022

CC @IanButterworth

@codecov
Copy link

codecov bot commented Feb 8, 2022

Codecov Report

Merging #244 (41faa86) into master (424523c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #244   +/-   ##
=======================================
  Coverage   91.86%   91.87%           
=======================================
  Files          12       12           
  Lines        1647     1649    +2     
=======================================
+ Hits         1513     1515    +2     
  Misses        134      134           
Impacted Files Coverage Δ
src/imfilter.jl 91.38% <100.00%> (+0.02%) ⬆️

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 424523c...41faa86. Read the comment docs.

@IanButterworth
Copy link
Member

Many thanks! Though I thought this would have a bigger effect

julia> @btime imfilter!(img2, img1, kern, "symmetric");
  19.865 ms (30 allocations: 7.69 MiB)

master

julia> @btime imfilter!(img2, img1, kern, "symmetric");
  20.384 ms (1031 allocations: 7.77 MiB)

Also, I don't quite understand why the key change here makes a difference.. if that if branch isn't hit, were the interpolations still done when inlined??!

@timholy
Copy link
Member Author

timholy commented Feb 9, 2022

It somehow triggers retention and propagation of a gcframe. I don't really understand the details, unfortunately.

@timholy timholy merged commit 47fae0a into master Feb 9, 2022
@timholy timholy deleted the teh/hoist_barrier branch February 9, 2022 00:45
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.

2 participants