Add caching to value_equality_values decorator for auto generated methods.#6275
Merged
tanujkhattar merged 4 commits intoquantumlib:masterfrom Sep 6, 2023
Merged
Conversation
value_equality_values decorator for auto generated methods.
pavoljuhas
reviewed
Aug 30, 2023
pavoljuhas
reviewed
Aug 30, 2023
pavoljuhas
approved these changes
Aug 30, 2023
Collaborator
pavoljuhas
left a comment
There was a problem hiding this comment.
Nit: _compat.cached_method(values_getter) can be reused so that the values_getter is evaluated once. Otherwise LGTM.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6275 +/- ##
=======================================
Coverage 97.87% 97.88%
=======================================
Files 1106 1106
Lines 95710 95717 +7
=======================================
+ Hits 93679 93690 +11
+ Misses 2031 2027 -4
☔ View full report in Codecov by Sentry. |
harry-phasecraft
pushed a commit
to PhaseCraft/Cirq
that referenced
this pull request
Oct 31, 2024
…ethods. (quantumlib#6275) * Add caching to value_equality_values decorator for auto generated methods. * Fix pylint and formatting errors * Address nits, fix bugs and make PauliSum unhashable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6272
cc #6097
Benchmarks can be seen by running
Before
After
A more real world example would be QROM in Cirq-FT, where
value_equality_valuesreturns all the data to be loaded by the QROM. Benchmarks as followsBefore
After