> 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.
* status: new => closed
* resolution: => wontfix
Comment:
Hi,
Thanks for the suggestion, though using a generator here would break the
method (try it out to see why).
The comment you quoted is referring to the `@functools.cache` decorator &
any additional optimisations would be negligible here.
--
Ticket URL: <https://code.djangoproject.com/ticket/35026#comment:1>