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

Force specialization on func::F #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Moelf
Copy link

@Moelf Moelf commented Jun 2, 2023

by default Julia does not specialize on this, this can be performance-critical in some cases.

by default Julia does not specialize on this, this can be performance-critical in some cases.
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #15 (4be7c4a) into main (40ad3aa) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #15   +/-   ##
=======================================
  Coverage   91.48%   91.48%           
=======================================
  Files           1        1           
  Lines          94       94           
=======================================
  Hits           86       86           
  Misses          8        8           
Impacted Files Coverage Δ
src/MultiThreadedCaches.jl 91.48% <100.00%> (ø)

Copy link
Collaborator

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too, but my understanding is that julia should be specializing on F already, because we call func() inside the body.

My understanding was that the heuristic is only that julia skips specializing on it only of the function isn't called:

Julia will always specialize when the argument is used within the method, but not if the argument is just passed through to another function.

https://docs.julialang.org/en/v1/manual/performance-tips/#Be-aware-of-when-Julia-avoids-specializing

Do you have a specific example where you were seeing issues, and where this helps? It would be great to understand that, and also to add that as a benchmark or as a test.

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.

3 participants