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

Improve LFUCache performance #260

Open
tkem opened this issue Mar 16, 2023 · 6 comments
Open

Improve LFUCache performance #260

tkem opened this issue Mar 16, 2023 · 6 comments
Assignees

Comments

@tkem
Copy link
Owner

tkem commented Mar 16, 2023

According to this two-year old gist, LFUCache performance seems to lack behind other cache variants.
Since nobody else seems to have noticed, I guess LFUCache is not in widespread use. However, it is a sane caching strategy, and improvements (instead of dropping it altogether) would be welcome.

@tkem tkem self-assigned this Mar 16, 2023
@tkem
Copy link
Owner Author

tkem commented Sep 18, 2023

According to this there is already an improved LFUCache implementation available which may be compatible.

@tkem
Copy link
Owner Author

tkem commented Sep 18, 2023

@breid48: Want to get on board and provide a PR for LFUCache?

@breid48
Copy link

breid48 commented Sep 23, 2023

@breid48: Want to get on board and provide a PR for LFUCache?

I'd be willing to submit a proposal. However, this will involve tearing out all of the existing LFUCache code in favour of a different design (namely, DLL).

Is this something that you would be interested in?

@tkem
Copy link
Owner Author

tkem commented Sep 23, 2023

I'm happy with replacing LFUCache implementation with something completely different, as long as it still fits with the rest of cachetools. So could you please elaborate a little on the design (pardon my ignorance, but "DLL" doesn't ring any bells with me in this context)?

@breid48
Copy link

breid48 commented Sep 23, 2023

Doubly linked list. The design will loosely follow the design proposed in this paper:

Ketan Shah, Anirban Mitra, and Dhruv Matani, An O(1) algorithm for implementing the LFU cache eviction scheme, (August 16, 2010).

Link

@tkem
Copy link
Owner Author

tkem commented Sep 24, 2023

Sorry, I should have guessed that 😜
Sure, feel free to use whatever implementation you see fit - lists, dicts, sets, whatever, as long as it doesn't introduce any new dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants