Skip to content

Add cached_method decorator for per-instance method caches #5570

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

Merged
merged 4 commits into from
Jun 24, 2022

Conversation

maffoo
Copy link
Contributor

@maffoo maffoo commented Jun 21, 2022

We've found this to be quite useful internally for speeding things up, and I think it could help a lot in cirq, particularly in places where we have _protocol_methods_ that can't be written as properties, but that we don't want to recompute each time they are called on an instance.

@maffoo maffoo requested review from a team, vtomole and cduck as code owners June 21, 2022 23:10
@maffoo maffoo requested a review from pavoljuhas June 21, 2022 23:10
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 21, 2022
@pavoljuhas
Copy link
Collaborator

LGTM. Added a small tweak in 5f1d631 after getting thoroughly confused by the repeated args name.

@maffoo maffoo merged commit c3419da into master Jun 24, 2022
@maffoo maffoo deleted the u/maffoo/cached-method branch June 24, 2022 08:10
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants