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

Implement _stablehash function for @cache keys #933

Open
lapp0 opened this issue May 31, 2024 · 0 comments
Open

Implement _stablehash function for @cache keys #933

lapp0 opened this issue May 31, 2024 · 0 comments

Comments

@lapp0
Copy link
Collaborator

lapp0 commented May 31, 2024

What behavior of the library made you think about the improvement?

Currently @cache relies on __getstate__, however it's not obvious when implementing this method that it should result in a regularized object which has a hash which is consistent with equivalent objects. Serialization doesn't necessitate an equivalent representation for equivalent objects as @brandonwillard pointed out in #929 (comment)

Further, cloudpickle doesn't guarantee determinism cloudpipe/cloudpickle#453

How would you like it to behave?

To ensure we avoid cache misses, we should first call cache_key._stablehash(), with __getstate__() as a fallback.

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