-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add support for method-wise cache invalidation. #71
Closed
willow-ahrens
wants to merge
17
commits into
JuliaCollections:global-const-cache
from
willow-ahrens:global-const-cache
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f742892
Add support for method-wise cache invalidation.
willow-ahrens 5b96b7f
typos
willow-ahrens 4ec35f5
factor out cache lookup
willow-ahrens 28652ad
style change
willow-ahrens 4230149
passes precompile test
willow-ahrens 3661204
Test precompile limitations
willow-ahrens b5e6dc3
one more quick test
willow-ahrens 24ee4d3
make the description of memories more correct.
willow-ahrens ddf9b4d
simplified a bit
willow-ahrens fe871ae
use local scope to store closure records
willow-ahrens cb11d0c
interesting.
willow-ahrens a6b3a1a
remove spurious isdefined check
willow-ahrens 4e9ab00
scope-speficity to avoid querying world age and calling which in loca…
willow-ahrens 04af86b
sneaky way to invalidate caches in closure scope.
willow-ahrens 6de8680
in the event we rename our function, we must define it first.
willow-ahrens 7f8b5de
Merge pull request #1 from peterahrens/local-scope
willow-ahrens 6057d38
simplify by removing custom which
willow-ahrens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "TestPrecompile" | ||
uuid = "ff0854c6-fbc5-40f0-bd2d-de277d7b8f28" | ||
authors = ["Peter Ahrens <[email protected]>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
Memoize = "c03570c3-d221-55d1-a50c-7939bbd78826" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module TestPrecompile | ||
using Memoize | ||
run = 0 | ||
@memoize function forgetful(x) | ||
global run += 1 | ||
return true | ||
end | ||
|
||
forgetful(1) | ||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = "TestPrecompile2" | ||
uuid = "7fd9c7c1-bae8-496a-aa66-4a9878cd045a" | ||
authors = ["Peter Ahrens <[email protected]>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
TestPrecompile = "ff0854c6-fbc5-40f0-bd2d-de277d7b8f28" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module TestPrecompile2 | ||
|
||
using TestPrecompile | ||
TestPrecompile.forgetful(2) | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm wrong, but this is where I believe that my approach will be just a few extra lines (mostly just to build the cache name with
Symbol(function_name, arg_names...)
instead of ~20. Macro complexity is especially bad, so unless my suggested approach has a fatal flaw, I believe it will be the way I will take.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose our difference of opinion lies in the trade-off between correctness and complexity. I suppose I'll just put my code in a separate package. Thanks for the helpful discussion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, worse is better comes to mind.
I'm sorry that it took so long to reach an impasse. Thank you for all your efforts!