leverage dict comprehension in PEP-0274 to improve performance
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Shared File Systems Service (Manila) |
Fix Released
|
Undecided
|
HouMing Wang |
Bug Description
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.
Manila does not support python 2.6, we can leverage this.
There is deep dive about PEP-0274[2] and basic tests about
performance[3].
[1]http://
[2]http://
[3]http://
description: | updated |
Changed in manila: | |
assignee: | nobody → Hou Ming Wang (houming-wang) |
status: | New → In Progress |
Reviewed: https:/ /review. openstack. org/255659 /git.openstack. org/cgit/ openstack/ manila/ commit/ ?id=51069d53906 83007ad612b15a8 82626326bd2d53
Committed: https:/
Submitter: Jenkins
Branch: master
commit 51069d539068300 7ad612b15a88262 6326bd2d53
Author: houming-wang <email address hidden>
Date: Wed Dec 9 22:56:18 2015 -0500
Performance: leverage dict comprehension in PEP-0274
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.
Manila does not support python 2.6, we can leverage this.
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/ doughellmann. com/2012/ 11/12/the- performance- impact- of-using
-dict-instead- of-in-cpython- 2-7-2.html paste.openstack .org/show/ 480757/
[2]http://
[3]http://
Change-Id: I87d26a46ef0d49 4f92afb1d3bebda 2797a12413c
Closes-Bug: #1524771