Skip to content

Conversation

bluetech
Copy link
Member

@bluetech bluetech commented Oct 1, 2021

The problem with @lru_cache on methods is that it also captures self and leaks it until the entry is evicted (if ever).

I was able to restore the caching in both cases (one straightforward case in the first commit, the other in the second commit).

The problem with `@lru_cache` on methods is that it also captures `self`
and leaks it until the entry is evicted (if ever).
Now that it's no longer using `@lru_cache`, use another check to avoid
re-computation. Although `@lru_cache` is faster than the full function
call + checks, this approach also has the advantage that the caching
works for more than 128 entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants