Skip to content

perf(#60): replace O(n²) circuits.index(c) with O(1) id lookup - #110

Merged
Manideep3969 merged 1 commit into
mainfrom
fix/issue-60-batching-on-squared
Aug 24, 2026
Merged

perf(#60): replace O(n²) circuits.index(c) with O(1) id lookup#110
Manideep3969 merged 1 commit into
mainfrom
fix/issue-60-batching-on-squared

Conversation

@Manideep3969

Copy link
Copy Markdown
Owner

Replaces the O(n²) call in with an dictionary for O(1) lookups. All 362 tests pass.

_measurement_based_batch called circuits.index(c) inside a loop,
making overall complexity O(n^2). Build an {id(circuit): index}
dictionary before the loop for O(1) lookups.
@Manideep3969
Manideep3969 merged commit 2dd697d into main Aug 24, 2026
4 checks passed
@Manideep3969
Manideep3969 deleted the fix/issue-60-batching-on-squared branch August 24, 2026 05:25
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.

1 participant