leverage dict comprehension in PEP-0274 to improve performance

Bug #1524771 reported by HouMing Wang
6
This bug affects 1 person
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://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/480757/

description: updated
Changed in manila:
assignee: nobody → Hou Ming Wang (houming-wang)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/255659
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=51069d5390683007ad612b15a882626326bd2d53
Submitter: Jenkins
Branch: master

commit 51069d5390683007ad612b15a882626326bd2d53
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/
    [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/480757/

    Change-Id: I87d26a46ef0d494f92afb1d3bebda2797a12413c
    Closes-Bug: #1524771

Changed in manila:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/manila 2.0.0.0b2

This issue was fixed in the openstack/manila 2.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.