• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 24355354818
87%

Build:
DEFAULT BRANCH: main
Ran 13 Apr 2026 05:13PM UTC
Jobs 1
Files 932
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Apr 2026 04:16PM UTC coverage: 87.485% (-0.002%) from 87.487%
24355354818

push

github

web-flow
Remove the commutation cache from the commutation checker (#15988)

An early performance optimization we made in the commutation analysis
pass in #3878 was to enable caching of the commutation relations between
gates. Back then the commutation was only checked via the matrix
multiplication method where we would compose a pair of gates' unitary
matrices forwards and backwards and determine if the product of those
forward and backward compositions were an identity. This was a fairly
costly operation back then for various reasons and the cache enabled a
large speedup by avoiding repeated computation unnecessarily. However,
since that time > 6 years ago the code base has evolved substantially,
including not relying on matrix multiplication based commutation
determination as the default. Now we have a precomputed library of
commuting gates and also have special handling for cases where we can
know very easily whether gates commute or not. Additionally, all of this
code has been ported to rust so the matrix multiplication based
approach is not nearly as expensive (although it's not free either).

In this new world the cache is actually doing more harm then good because
maintaining the cache, adding extra lookups and hashing while constant
time is not free. We've reached a point where all the complexity of the
cache is no longer worth it, so this commit removes the commutation
cache. One caveat is some aspects of this internal cache have leaked
into the public API. Specifically the CommutationChecker class is
public, and that includes a documented init argument `cache_max_entries`
as well as two public methods `clear_cached_commutations` and
`num_cached_entries`. I believe the original intent for these methods
was either debugging the cache logic was correct (as they were used in
tests) or to enable the user to manage the cache size manually if they
so wished. The `cache_max_entries` argument was used to manage the total
memory size for the cache to avoid us... (continued)

7 of 8 new or added lines in 2 files covered. (87.5%)

5 existing lines in 1 file now uncovered.

104546 of 119502 relevant lines covered (87.48%)

982614.44 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
90.48
-3.97% qiskit/circuit/commutation_checker.py

Coverage Regressions

Lines Coverage ∆ File
5
92.54
0.0% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 24355354818.1 13 Apr 2026 05:13PM UTC 932
87.48
GitHub Action Run
Source Files on build 24355354818
  • Tree
  • List 932
  • Changed 5
  • Source Changed 2
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24355354818
  • 0d63a936 on github
  • Prev Build on gh-readonly-queue/main/pr-15941-5bf891982250577a45324b5ad21e1f29faf84893 (#24352109798)
  • Next Build on main (#24389423094)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc