#26693: RenameModel causes state.apps rendering leading to massive time 
increase in
makemigrations
--------------------------------+--------------------------------------
     Reporter:  simonpercivall  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  new
    Component:  Migrations      |                  Version:  1.9
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------
Changes (by simonpercivall):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> Not 100% sure I have complete understanding of what happens, or why, but
> it seems a `RenameModel` migration leads to an evaluation of
> `state.apps`, which affects the time it takes for it and all following
> migration states to be calculated.
>
> This is for a pretty big app, with lots of migrations. The time to run
> `makemigrations` for all apps goes from 1 seconds to 77 seconds with one
> `RenameModel` migration.
>
> A test where `apps.state` was replaced by `temp_state = state.close();
> apps = temp_state.apps` resolved the issue, but I'm not completely sure
> of the side effects of doing that.

New description:

 Not 100% sure I have complete understanding of what happens, or why, but
 it seems a `RenameModel` migration leads to an evaluation of `state.apps`,
 which affects the time it takes for it and all following migration states
 to be calculated.

 This is for a pretty big app, with lots of migrations. The time to run
 `makemigrations` for all apps goes from 1 seconds to 77 seconds with one
 `RenameModel` migration.

 A test where `apps.state` was replaced by `temp_state = state.close();
 apps = temp_state.apps` resolved the issue, but I'm not completely sure of
 the side effects of doing that. (Or even better if it were possible to
 check immediately if `'apps' in state.__dict__` and skip the rendering
 completely.)

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26693#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.80830cc97fe61ed2999056a4e4fc7b12%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to