Skip to content

Conversation

jakelishman
Copy link
Member

Summary

This re-uses the same growable scratch space for storing the temporary swaps for each choice. This particular space typically needed to grow several times for each swap choice, which was taking up a non-negligible amount of the time we spent in Rust space, especially for large circuits on big coupling maps.

Details and comments

This is a super simple change, but drastically reduces the number of allocations / re-allocations we have to make during the inner Rust-space loops. Using the same test example as #10782, I had the timings go from 2.01(3)s on main to 1.88(2)s s with this PR (the numbers are larger because I've got webex open at the moment lol), and the improvements will stack almost perfectly with the improvements of #10782.

This PR will conflict slightly with #10782, and I'll update whichever merges second.

This re-uses the same growable scratch space for storing the temporary
swaps for each choice.  This particular space typically needed to grow
several times for each swap choice, which was taking up a non-negligible
amount of the time we spent in Rust space, especially for large circuits
on big coupling maps.
@jakelishman jakelishman added performance Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository mod: transpiler Issues and PRs related to Transpiler labels Sep 6, 2023
@jakelishman jakelishman requested a review from a team as a code owner September 6, 2023 14:51
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

@mtreinish mtreinish added this pull request to the merge queue Sep 6, 2023
Merged via the queue into Qiskit:main with commit 7252db3 Sep 6, 2023
@jakelishman jakelishman deleted the sabre/reuse-swap-scratch branch September 6, 2023 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog mod: transpiler Issues and PRs related to Transpiler performance Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants