quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Optimize qid comparisons #6386

Closed maffoo closed 9 months ago

maffoo commented 9 months ago

Qid comparison turns out to be a very common operation when manipulating circuits, for example when computing the hash of a moment we sort operations by qubits in order to have a canonical order for hashing. Here we optimize the comparison of common qid types for grid, line, and named qubits.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2f3c1e2) 97.81% compared to head (4066f83) 97.81%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6386 +/- ## ======================================= Coverage 97.81% 97.81% ======================================= Files 1111 1111 Lines 96951 97001 +50 ======================================= + Hits 94828 94878 +50 Misses 2123 2123 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.