-
Notifications
You must be signed in to change notification settings - Fork 60
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
[New] Size limited LRU cache #58
Comments
There is a small problem - it seems to me that it works a little slow, I still have no idea how to speed up |
I took a look at the different implementations and I think that it could be possible to adapt pympler's Here is my slightly modified implementation : |
I just tested the different implementations and yes our implementation is quite slow, |
Or maybe we could check if the object is a native object, in which case we would check with |
Maybe implement asynchronous checking and clearing the cache using ThreadPoolExecutor? This should speed up the caching process |
Well I tried to implement it too in 58521f1 but seems to also be slow I'll need to figure out why because it seems odd... |
So I tried to optimise the LRU cache, and it seems I have it. Some numbers: raw dictionary implementation code:
Also in the test, I changed the old LRU implementation to use Just raw dictionary time:
Old LRU cache implementation time:
New LRU cache implementation time:
New LRU implementation code: |
Ohhh I understand how you did that. Really cool numbers! Did you try on python <3.7 to see if it was working as well ? |
Hmm, no. I'll try to install debian stretch on my machine and test it there with Python 3.5. |
Yes, it works great! Some debugging shows that all the logic works as expected. |
I think this issue can be closed, since we have merged into next branch |
I made a small working prototype of the cache implementation on top of OrderedDict. Please write what can be improved.
https://gist.github.com/ZhymabekRoman/a9c7a25c155dfdea52277cc74f28fa65
The text was updated successfully, but these errors were encountered: