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

Automatic cache clearing with lru_cache's maxsize #1150

Closed
Pierre-Sassoulas opened this issue Aug 27, 2021 · 2 comments · Fixed by #1565
Closed

Automatic cache clearing with lru_cache's maxsize #1150

Pierre-Sassoulas opened this issue Aug 27, 2021 · 2 comments · Fixed by #1565
Labels
Enhancement ✨ Improvement to a component topic-performance

Comments

@Pierre-Sassoulas
Copy link
Member

Following #1139, it's not possible to clear the cache. We did not use lru_cache because the current implementation only uses the first argument as key (because the other one is context?), and lru_cache does not allow that.

In order to use lru_cache we need to ask ourselves if is it right that inference tip functions always take exactly two arguments -- a node and a context? If so, what is context exactly? Does it remain constant during an inference session? Is it fine to hash it via id()?

See original comment by @superbobry here and here

Current behavior

The cache can be cleared with an API.

Expected behavior

Automatic clearing when the cache increase above a set value (configurable ?).

@jacobtylerwalls
Copy link
Member

Reopening because #1565 will likely be reverted.

@jacobtylerwalls jacobtylerwalls removed this from the 2.12.0 milestone May 23, 2022
@jacobtylerwalls
Copy link
Member

The interface for clearing astroid's various caches is astroid.MANAGER.clear_cache(). If we missed one, please open a new issue and provide details. Thanks all!

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component topic-performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants