In my application, with ~250 models, this deepcopy is around 5% of
migration time. I was able to cleanup `StateApps` before copy, to not copy
all models and apps every operation again.
--
Ticket URL: <https://code.djangoproject.com/ticket/33848>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> `StateApps.clone` execute two slow deep copies. The first one copy all
> models. The second one copy app configs, that include all apps and the
> specific app models.
>
> In my application, with ~250 models, this deepcopy is around 5% of
> migration time. I was able to cleanup `StateApps` before copy, to not
> copy all models and apps every operation again.
>
> https://github.com/django/django/blob/d4c5d2b52c897ccc07f04482d3f42f976a79223c/django/db/migrations/state.py#L683
New description:
`StateApps.clone` execute two slow deep copies. The first one copy all
models. The second one copy app configs, that include all apps and the
specific app models.
In my application, with ~250 models, this deepcopy is around 5% of
migration time. I was able to cleanup `StateApps` before copy, to not copy
all models and apps every operation again. After the optimization, it
takes less than 1% of migration time.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33848#comment:1>
* cc: Simon Charette (added)
* owner: nobody => Iuri de Silvio
* status: new => assigned
* stage: Unreviewed => Accepted
Comment:
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/33848#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33848#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f0fa2a3b49797f1e9830e2a0d2072119093b4452" f0fa2a3b]:
{{{
#!CommitTicketReference repository=""
revision="f0fa2a3b49797f1e9830e2a0d2072119093b4452"
Fixed #33848 -- Optimized StateApps.clone().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33848#comment:4>