From 38388873ee7b36ab582acc2559dd1c5bc26aa17d Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Wed, 30 Apr 2025 16:14:12 +0530 Subject: [PATCH 1/3] remove deepcopy --- src/pyqasm/visitor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pyqasm/visitor.py b/src/pyqasm/visitor.py index 8435e901..cc758458 100644 --- a/src/pyqasm/visitor.py +++ b/src/pyqasm/visitor.py @@ -1098,7 +1098,6 @@ def _visit_generic_gate_operation( # pylint: disable=too-many-branches Returns: None """ - operation, ctrls = copy.deepcopy(operation), copy.deepcopy(ctrls) negctrls = [] if ctrls is None: ctrls = [] From dd1317e11c48c276bde88f632868a4c7c59c61be Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Thu, 1 May 2025 13:33:15 +0530 Subject: [PATCH 2/3] use copy instead of deepcopy --- src/pyqasm/visitor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pyqasm/visitor.py b/src/pyqasm/visitor.py index cc758458..bb24ef47 100644 --- a/src/pyqasm/visitor.py +++ b/src/pyqasm/visitor.py @@ -1098,6 +1098,7 @@ def _visit_generic_gate_operation( # pylint: disable=too-many-branches Returns: None """ + operation, ctrls = copy.copy(operation), copy.copy(ctrls) negctrls = [] if ctrls is None: ctrls = [] From 26387c6157ad7c3dd65ed86931454d39119e4287 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Thu, 1 May 2025 13:44:34 +0530 Subject: [PATCH 3/3] add changelog [no ci] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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