Replace sortedcontainers with builtin collections#8020
Merged
pavoljuhas merged 7 commits intoquantumlib:mainfrom Apr 8, 2026
Merged
Replace sortedcontainers with builtin collections#8020pavoljuhas merged 7 commits intoquantumlib:mainfrom
pavoljuhas merged 7 commits intoquantumlib:mainfrom
Conversation
SortedSet needs to be ordered just once for iteration. SortedDict ordering was not necessary at all.
…n the test" And also clean up collected timings
Collaborator
Author
|
To check how performance changes with SortedSet replacement, here are timeit durations from initialization_test.py collected using pytest -s --randomly-seed=99 --randomly-dont-reorganize --pyargs \
cirq.contrib.routing.initialization_testand plotted as a histogram of durations before and after this PR:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8020 +/- ##
==========================================
- Coverage 99.63% 99.63% -0.01%
==========================================
Files 1110 1110
Lines 99755 99755
==========================================
- Hits 99394 99392 -2
- Misses 361 363 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
For routing reproducibility the best_candidates extracted from dictionary keys need to be sorted as before with SortedDict.
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.

Eliminate unnecessary dependency on the sortedcontainers package.
Used in only one module where SortedSet could be ordered just once
after collection and where SortedDict could be also sorted later.
The median timeit timing of the affected
get_initial_mappingcallsfrom unit test improved by about 20%.