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

Improve stimcirq serialization #7192

Merged

Conversation

dstrain115
Copy link
Collaborator

  • 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%.
@dstrain115 dstrain115 requested review from wcourtney, vtomole, verult and a team as code owners March 27, 2025 00:36
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (b16aeda) to head (21c1101).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dstrain115 dstrain115 requested a review from senecameeks March 27, 2025 17:25
@dstrain115
Copy link
Collaborator Author

Could I get a review on this, so I can start testing the new proto serialization?

Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add unit tests to stimcirq_serializer?

@@ -0,0 +1,101 @@
# Copyright 2019 The Cirq Developers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

year?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,99 @@
# Copyright 2019 The Cirq Developers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dstrain115
Copy link
Collaborator Author

@NoureldinYosri The round trip test is in circuit_serializer_test, but I added a test in stimcirq_serializer_test as well.

@dstrain115 dstrain115 added this pull request to the merge queue Apr 2, 2025
Merged via the queue into quantumlib:main with commit f6187b3 Apr 2, 2025
38 checks passed
@dstrain115 dstrain115 deleted the better_stimcirq_serialization branch April 2, 2025 15:21
@mhucka mhucka changed the title Better stimcirq serialization Improve stimcirq serialization Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants