Opened 10 years ago
Closed 10 years ago
#24397 closed Cleanup/optimization (fixed)
Speed up model rendering with apps.ready = False
Reported by: | Marten Kenbeek | Owned by: | Marten Kenbeek |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Marten Kenbeek | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Whenever a model is rendered, the cache of several values in model._meta
is cleared on each known model. This has a severe performance impact when rendering large amounts of models.
When apps.ready
is False
, the cache of model meta options is not cleared. This speeds up the initial rendering of the test suite significantly. The cache can then be cleared manually when all models are rendered, and apps.ready
can be set back toTrue
.
Results timing django.test.runner.DiscoverRunner.setup_databases
:
apps.ready == True - 42 seconds apps.ready == False - 16 seconds
Change History (9)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → new |
Reopen due to further improvements.
comment:6 by , 10 years ago
Patch needs improvement: | set |
---|
Left some mostly cosmetic comments. Please advance to "Ready for Checkin" after updating.
comment:7 by , 10 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
I'm not too sure what the error message should be changed to, so I'll leave it as is.
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
In 888c9b6429a44824078a49fb1ebacf2e950cd887: