Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23837 closed Cleanup/optimization (fixed)

Replace list.pop(0) by deque.popleft() in dfs function in migrations

Reported by: Zweedeend Owned by: Zweedeend
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Zweedeend Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The function dfs in dj.migrations.graph uses list.pop(0) and insert(0, ...).

These methods are not efficient for lists. Using a deque with the methods popleft and extendleft is more efficient.

Change History (7)

comment:1 by Zweedeend, 10 years ago

Owner: set to Zweedeend
Status: newassigned

comment:2 by Zweedeend, 10 years ago

Cc: Zweedeend added

comment:3 by Zweedeend, 10 years ago

Has patch: set

comment:5 by Aymeric Augustin, 10 years ago

Zweedeend, can you turn this into a proper pull request so the CI runs it?

comment:6 by Niels Kouwenhoven <nielskouwenhoven@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In fefb77934e6b8f91ce44be7e1438146cb99baa19:

Fixes #23837: Replace list.pop(0) by deque.popleft() in dfs function in migrations

comment:7 by Carl Meyer <carl@…>, 10 years ago

In 1ed9b9e2e2b62f6ef89558f98d786e9fcd649152:

Merge pull request #3536 from Zweedeend/ticket_23837

Fixes #23837: Replace list with deque in migration-planner for improved performance.

Note: See TracTickets for help on using tickets.
Back to Top