diff --git a/CHANGELOG.md b/CHANGELOG.md index 004d65d4..55fc6487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ Types of changes: ### Improved / Modified +- Optimized `_visit_generic_gate_operation` in `QasmVisitor` class by using shallow copy instead of deep copy for better performance when processing gate operations. ([#180](https://github.com/qBraid/pyqasm/pull/180)) + ### Deprecated ### Removed diff --git a/src/pyqasm/visitor.py b/src/pyqasm/visitor.py index 8435e901..bb24ef47 100644 --- a/src/pyqasm/visitor.py +++ b/src/pyqasm/visitor.py @@ -1098,7 +1098,7 @@ def _visit_generic_gate_operation( # pylint: disable=too-many-branches Returns: None """ - operation, ctrls = copy.deepcopy(operation), copy.deepcopy(ctrls) + operation, ctrls = copy.copy(operation), copy.copy(ctrls) negctrls = [] if ctrls is None: ctrls = []