-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add concise serialization tools. #3601
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
Add concise serialization tools. #3601
Conversation
balopat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Added some comments!
|
Automerge cancelled: A required status check is not present. Missing statuses: ['Build docs', 'Build protos', 'Changed files test', 'Coverage check', 'Doc test', 'Format check', 'Lint check', 'Misc check', 'Notebook formatting', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Type check', 'cla/google'] |
Part of #3235. Also contributes to #3438.
This PR adds a
SerializableByKeyinterface which any Cirq object can implement to enable more concise JSON serialization of repeated objects. Enabling this behavior for various types is left to future PRs.For comparison, consider MatrixGate:
Without concise serialization for MatrixGate:
Details
With concise serialization for MatrixGate:
Details
Note that
some_big_matrixappears three times in the current serialization, but only once with concise serialization.