potiuk commented on issue #6596: [AIRFLOW-6004] Untangle Executors class to 
avoid cyclic imports
URL: https://github.com/apache/airflow/pull/6596#issuecomment-560017256
 
 
   > Is this going to make it slower -- i.e. does this genrate a list of keys 
and then do a list search for the key vs just a direct hash lookup?
   > 
   > What was the error? This feels like a bug in mypy rather than a bug in our 
code.
   
   That used to be much slower in python2, but in python3 it's just a bit 
slower as keys() does not return list of keys (as it used to be) but 
DictKeyView() (which is backed by the original dict and is updated as the dict 
updates). See for example here (I repeated those benchmarks with similar 
results): 
https://stackoverflow.com/questions/10205969/why-in-operator-with-tuple-as-a-key-in-python-so-slow.
 And the overhead is not proportional to the size of the dict - it's more to 
construct the dynamic ListView. And "in" operator is equally fast - doint hash 
lookup() rather than linear search as it used to be in Python2.
   
   This change was more of my process of adding types - I wanted to understand 
all the types and make sure they are correct, so I can revert it.
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to