ec2-api/ec2api/metadata
Andrey Pavlov 97e72e40d0 Performance: leverage dict comprehension in PEP-0274
merged from Ifb5cb05b9cc2b8758d5a8e34f7792470a73d7c40

PEP-0274 introduced dict comprehensions to replace dict constructor
with a sequence of length-2 sequences, these are benefits copied
from [1]:
  The dictionary constructor approach has two distinct disadvantages
  from the proposed syntax though.  First, it isn't as legible as a
  dict comprehension.  Second, it forces the programmer to create an
  in-core list object first, which could be expensive.
Nova dropped python 2.6 support, we can leverage this now.
There is deep dive about PEP-0274[2] and basic tests about
performance[3].
Note: This commit doesn't handle dict constructor with kwagrs.
This commit also adds a hacking rule.

[1]http://legacy.python.org/dev/peps/pep-0274/
[2]http://doughellmann.com/2012/11/12/the-performance-impact-of-using-dict-instead-of-in-cpython-2-7-2.html
[3]http://paste.openstack.org/show/154798/

Change-Id: I1bc53e335b6c291da5c54f067f9fdfd5da6b2902
2015-04-02 16:07:58 +03:00
..
__init__.py Get rid of Nova DB access 2015-03-20 15:33:05 +03:00
api.py Performance: leverage dict comprehension in PEP-0274 2015-04-02 16:07:58 +03:00