#35102: Performance regression on Model.objects.count() between Django 4.2 and 
5.0
-------------------------------------+-------------------------------------
     Reporter:  Anthony Shaw         |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * cc: Simon Charette (added)


Comment:

 > get_aggregation has an additional call to replace_expressions which
 spends a lot of time in the slow inspect module

 One way we could cut the time spent in `Expression.identity` significantly
 would be to cache (e.g. at class initialization time) the
 `inspect.signature(cls.__init__)` signature as it represents the vast
 majority of the time spent by `replace_expressions`

 [[Image(https://cdn.zappy.app/dd47f5e7d4c03baff4726eb106e0d440.png)]]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35102#comment:8>
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/0107018cfa124123-d50dfe58-64a0-40de-9722-0d831c5d6acc-000000%40eu-central-1.amazonses.com.

Reply via email to