Skip to content

Improve performance of OutputRecordingPass when processing QIR simulation results#3235

Merged
swernli merged 1 commit into
mainfrom
swernli/output-recording-perf
May 19, 2026
Merged

Improve performance of OutputRecordingPass when processing QIR simulation results#3235
swernli merged 1 commit into
mainfrom
swernli/output-recording-perf

Conversation

@swernli
Copy link
Copy Markdown
Collaborator

@swernli swernli commented May 19, 2026

This change updates the pattern used to process results in the OutputRecordingPass to avoid the perf hit from running Python eval for each result. This led to high overhead as each input needed to be parsed and processed by a fresh Python environment. Instead the code uses eval once to create a lambda for processing and then is able to invoke it directly on each result, speeding up processing.

…lation results

This change updates the pattern used to process results in the `OutputRecordingPass` to avoid the perf hit from running Python `eval` for each result. This led to high overhead as each input needed to be parsed and processed by a fresh Python environment. Instead the code uses `eval` once to create a lambda for processing and then is able to invoke it directly on each result, speeding up processing.
Comment thread source/qdk_package/qdk/simulation/_simulation.py
@swernli swernli enabled auto-merge May 19, 2026 16:49
@swernli swernli added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 5076bd5 May 19, 2026
12 checks passed
@swernli swernli deleted the swernli/output-recording-perf branch May 19, 2026 17:21
pull Bot pushed a commit to Mattlk13/qsharp that referenced this pull request May 19, 2026
The change in microsoft#3235 introduced a bug if the underlying simulation
failed, which was caught by GPU tests post-merge. This changes the
pattern to account for situations where the shot output might be empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants