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

Qiskit / qiskit-terra / 5892847128
87%
main: 87%

Build:
Build:
LAST BUILD BRANCH: sparsepauliop_default_init
DEFAULT BRANCH: main
Ran 17 Aug 2023 03:58PM UTC
Jobs 1
Files 1268
Run time 24min
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

17 Aug 2023 03:23PM UTC coverage: 87.254% (-0.02%) from 87.278%
5892847128

push

github

web-flow
Fix performance of Sabre rust<->Python boundary (#10652)

* Fix performance of Sabre rust<->Python boundary

In #10366 the SabreLayout and SabreSwap passes were refactored to
support nested control flow blocks. As part of that refactor a new
struct SabreResult was created to store the nested results for each
block. This new class however resulted in PyO3 cloning the full swap map
on every access. Since we have at least 1 access per gate in the circuit
(and another one for each swap) this extra clone() adds a lot of extra
overhead for deep circuits. In extreme cases this regression could be
quite extreme. To address this the result format is changed to be a
tuple (as it was originally), while this is less ergonomic the advantage
it provides is that for nested objects it moves the rust object to the
pyo3 interface so we avoid a copy as Python owns the object on the
return. However, for control flow blocks we're still using the
SabreResult class as it simplifies the internal implementation (which is
why #10366 introduced the struct). The potential impact of this is
mitigated by switching to only a single clone per control flow block,
by only accessing the SabreResult object's attribute on each recursive
call. However, if it is an issue in the future we can work on flattening
the nested structure before returning it to python to avoid any clones.

Fixes #10650

* Simplify recursive call logic in _apply_sabre_result

This commit simplifies the logic in the recursive call logic in
_apply_sabre_result to always use a tuple so we avoid an isinstance
check.

Co-authored-by: Kevin Hartman <kevin@hart.mn>

---------

Co-authored-by: Kevin Hartman <kevin@hart.mn>

25 of 25 new or added lines in 3 files covered. (100.0%)

74349 of 85210 relevant lines covered (87.25%)

60767.92 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
93.76
-0.24% crates/qasm2/src/expr.rs
2
80.0
-2.22% qiskit/extensions/quantum_initializer/squ.py
4
91.39
0.25% crates/qasm2/src/lex.rs
24
96.2
-1.86% crates/qasm2/src/parse.rs
Jobs
ID Job ID Ran Files Coverage
1 5892847128.1 17 Aug 2023 03:58PM UTC 1268
87.25
GitHub Action Run
Source Files on build 5892847128
  • Tree
  • List 1268
  • Changed 26
  • Source Changed 0
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • e6c431e3 on github
  • Prev Build on main (#5892079640)
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

© 2025 Coveralls, Inc