#35026: Improving perfromance of the apps registry `get_models()` method
-------------------------------------+-------------------------------------
Reporter: Kamil | Owner: nobody
PaduszyĆski |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords: apps, models
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When studying the "applications" framework, I noticed that in
`django.apps.apps.get_models()` you mention in the comment.
> This method is performance-critical at least for Django's test suite.
If fact, the method involves a standard list extenstions. Has anyone
consider to implement this using `itertools.chain`?
{{{
#!python
from itertools import chain
# ...
def get_models(self, include_auto_created=False, include_swapped=False):
return chain(
*(app_config.get_models(include_auto_created, include_swapped)
for app_config in self.get_app_configs())
)
}}}
Shouldn't using a generator result in increased performance?
--
Ticket URL: <https://code.djangoproject.com/ticket/35026>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018c4bcfeffd-94fa685f-2c1b-4b14-95f8-469854ae15fd-000000%40eu-central-1.amazonses.com.