Improve stimcirq serialization#7192
Merged
dstrain115 merged 8 commits intoquantumlib:mainfrom Apr 2, 2025
Merged
Conversation
Collaborator
dstrain115
commented
Mar 27, 2025
- After some testing, the serialization for stimcirq was a bit subpar. Serializing the json was rather bulky.
- This splits the stimcirq serialization and deserialization into its own file, so its more encapsulated.
- This also serializes each operation directly, rather than jamming the whole json into the gate.
- For a typical QEC surface code circuit, this reduces the size of the proto by about 25%.
- After some testing, the serialization for stimcirq was a bit subpar. Serializing the json was rather bulky. - This splits the stimcirq serialization and deserialization into its own file, so its more encapsulated. - This also serializes each operation directly, rather than jamming the whole json into the gate. - For a typical QEC surface code circuit, this reduces the size of the proto by about 25%.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7192 +/- ##
==========================================
- Coverage 98.15% 98.14% -0.01%
==========================================
Files 1100 1104 +4
Lines 96253 96352 +99
==========================================
+ Hits 94473 94564 +91
- Misses 1780 1788 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Could I get a review on this, so I can start testing the new proto serialization? |
Collaborator
NoureldinYosri
left a comment
There was a problem hiding this comment.
can we add unit tests to stimcirq_serializer?
| @@ -0,0 +1,101 @@ | |||
| # Copyright 2019 The Cirq Developers | |||
| @@ -0,0 +1,99 @@ | |||
| # Copyright 2019 The Cirq Developers | |||
Collaborator
Author
|
@NoureldinYosri The round trip test is in circuit_serializer_test, but I added a test in stimcirq_serializer_test as well. |
NoureldinYosri
approved these changes
Apr 1, 2025
This was referenced May 30, 2025
BichengYing
pushed a commit
to BichengYing/Cirq
that referenced
this pull request
Jun 20, 2025
* Better stimcirq serialization - After some testing, the serialization for stimcirq was a bit subpar. Serializing the json was rather bulky. - This splits the stimcirq serialization and deserialization into its own file, so its more encapsulated. - This also serializes each operation directly, rather than jamming the whole json into the gate. - For a typical QEC surface code circuit, this reduces the size of the proto by about 25%. * Fix coverage and typing. * try again for typecheck * Fix merge issues. * sort imports * Add serializer unit tests.
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.