-
Notifications
You must be signed in to change notification settings - Fork 16
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
creating cache for faster access to results of previous cnmf extension calls #62
Conversation
This is a great start! I'l implement the following methods: clear()
set_maxsize() all I can think of for now |
For use in the extensions, I'd create a separate Cache instance for each extension class. Both mcorr and cnmf have a |
will work on testing out cache for different cnmf and mcorr extension functions as well as checking reduced time in accessing!! |
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.
almost there! :D
also for some reason tests are failing for cnmfe, weird because they're passing on |
… entry of array or dict
just did basic impl of using memory size, appears to be working when I test it out wasn't completely sure how you wanted the bounds to work because the likelihood of the number you set for bytes being equivalent to the number that the output sizes in the cache will add up to be is unrealistic can go back and alter impl so that if adding an item will cause cache to go over cache size, will remove the most recently used item...but this could also cause many items to be removed if removing simply a path for example will not necessarily cause a huge change to size of outputs but that was the most recently accessed item in the cache |
Yes you are right! I'm assuming you mean removing the least recently used, not most recently used. Anyways there's a very simple way on this line 118 to make sure that it never exceeds the cache size! In general there's a more elegant way to implement your control flow here. |
I think that the reason the tests are failing is because cached values are being returned even though new args have been passed. I'm guessing this because there's a mismatch in the shape of input arrays which corroborates with the size of |
last commit message should be |
I just realized, for things like |
Will implement after I fix residuals and reconstructed movie extensions |
ok left to do:
Is this still an issue?
|
…mf object size computation, linter
yay other than my comments about the copy, just need to write tests for cache!
|
So cache makes a big difference, reconstructed, residuals etc. movies are now FAST random-access scrollable. The majority of the time is spent in fetching data, the outer product doesn't take very long so we don't need to decorate without_cache-2022-07-12_00.34.37.mp4with_cache-2022-07-12_00.30.51.mp4 |
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 think it'd also be useful to have cache tests to make sure that it's returning the cached vals for the correct function and item (by checking the UUID).
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.
LGTM! Awesome job!
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.
Just a few minor things and I will merge! :D Test should pass on github after these changes!
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.
yay, test pass, going to merge
adding file to extensions for a cache
cache should allow users to quickly access results of previously made calls to cnmf extensions that have the same
function_name, args,
andkwargs