Lee-W commented on code in PR #33934:
URL: https://github.com/apache/airflow/pull/33934#discussion_r1311074991
##########
airflow/models/dag.py:
##########
@@ -1699,7 +1699,7 @@ def _get_task_instances(
if include_subdags:
# Crafting the right filter for dag_id and task_ids combo
conditions = []
- for dag in self.subdags + [self]:
+ for dag in [*self.subdags, self]:
Review Comment:
I did some tests on it. It seems performance wise `[*[1, 2, 3], 4, 5, 6, 7]`
is the best solution
```
$ python -m timeit '[1, 2, 3] + [4] + [5] + [6] + [7]'
2000000 loops, best of 5: 179 nsec per loop
$ python -m timeit '[*[1, 2, 3], 4, 5, 6, 7]'
5000000 loops, best of 5: 69.2 nsec per loop
$ python -m timeit 'import itertools; itertools.chain([1, 2, 3], [4, 5, 6,
7])'
2000000 loops, best of 5: 177 nsec per loop
$ python -m timeit 'import itertools; [1, 2, 3] + [4] + [5] + [6] + [7]'
1000000 loops, best of 5: 242 nsec per loop
$ python -m timeit 'import itertools; [*[1, 2, 3], 4, 5, 6, 7]'
2000000 loops, best of 5: 131 nsec per loop
$ python -m timeit 'import itertools; list(itertools.chain([1, 2, 3], [4, 5,
6, 7]))'
1000000 loops, best of 5: 305 nsec per loop
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]