Middleware creates tuple on every iteration of a loop

Bug #1359245 reported by Ian Cordasco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Ian Cordasco

Bug Description

In this generator [1] (nested in a for-loop) the middleware constantly recreates the same tuple. This would perform better if two changes were made:

1. Use a set instead of a tuple
2. Assign the set once outside of the for-loop saving several object creations.

[1]: https://github.com/openstack/horizon/blob/0f3192f84c872b1060ac6b7bbe1a3b34bbaf1b36/horizon/middleware.py#L179..L180

Ian Cordasco (icordasc)
Changed in horizon:
assignee: nobody → Ian Cordasco (icordasc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/115691

Changed in horizon:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/115691
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=961ce7363b865103d022a2119cf1e101557226e2
Submitter: Jenkins
Branch: master

commit 961ce7363b865103d022a2119cf1e101557226e2
Author: Ian Cordasco <email address hidden>
Date: Wed Aug 20 10:43:35 2014 -0500

    Use a singly created set while copying cookies

    Previously a tuple was being created while iterating over each of the
    arguments of a cookie for every cookie. This will prevent creating a tuple
    that many times and uses a set to increase the performance of look-up using
    `in`.

    Change-Id: I10ffccae8eb3a9cb41b1045a08b891fed43efd99
    Closes-Bug: 1359245

Changed in horizon:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: none → juno-3
importance: Undecided → Low
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
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.