XD-DENG commented on a change in pull request #13449:
URL: https://github.com/apache/airflow/pull/13449#discussion_r551008494



##########
File path: airflow/models/dag.py
##########
@@ -361,8 +361,7 @@ def __repr__(self):
         return f"<DAG: {self.dag_id}>"
 
     def __eq__(self, other):
-        if type(self) == type(other) and self.dag_id == other.dag_id:
-
+        if type(self) == type(other):

Review comment:
       That optimisation may not make sense given two reasons below:
   - `all()` function has the "exit fast" property, i.e., whenever there is any 
`False` element, it will return `False` immediately, rather than traversing all 
elements in the iterable. 
[reference](https://docs.python.org/3/library/functions.html#all)
   - For `dag` model, `dag_id` is the 1st element in `_comps`; For 
`BaseOperator`, `task_id` is the 1st element in `_comps`.
   
   So after the change I make here, there should be zero impact on the 
performance (actually it improves the performance very minorly: it helps avoid 
comparing `dag_id` in `dag` model's `__eq__`for two times. Similar for 
`BaseOperator`).
   
   Kindly let me know if it makes sense to you?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to