potiuk commented on PR #33762:
URL: https://github.com/apache/airflow/pull/33762#issuecomment-1694211308

   Yeah. Performance is noticeably faster. Fine for me
   
   From 
https://stackoverflow.com/questions/6610606/is-there-a-difference-between-using-a-dict-literal-and-a-dict-constructor
   
   Literal is much faster, since it uses optimized BUILD_MAP and STORE_MAP 
opcodes rather than generic CALL_FUNCTION:
   
   ```
   python2.7 -m timeit "d = dict(a=1, b=2, c=3, d=4, e=5)"
   1000000 loops, best of 3: 0.958 usec per loop
   
   python2.7 -m timeit "d = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5}"
   1000000 loops, best of 3: 0.479 usec per loop
   
   python3.2 -m timeit "d = dict(a=1, b=2, c=3, d=4, e=5)"
   1000000 loops, best of 3: 0.975 usec per loop
   
   python3.2 -m timeit "d = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5}"
   1000000 loops, best of 3: 0.409 usec 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]

Reply via email to