#34631: Expression.identity() performance
-------------------------------------+-------------------------------------
Reporter: Blaž | Owner: nobody
Šnuderl |
Type: | Status: new
Uncategorized |
Component: Database | Version: 4.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Expression class defines an identity uses that relies heavily on
reflection/inspect to generate identity of its objects. This is generally
gonna be slow and does a lot of extra work compared to hand writing these
identity expressions.
Based on some simple profiling in our project, I saw a lot of query
building time being spent in this identity function. Atleast for simple
queries vast majority of Expression objects are ''Col'', one per column in
the model.
My proposal would be to optimize atleast this case, but potentially we can
also explore whether we need such complicated identity and all and if we
could avoid the inspect calls in general.
I have opened a very simple PR demonstrating a possible improvement here
https://github.com/django/django/pull/16940 and it passes all django tests
and I also ran it on our projects test suite without issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/34631>
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/0107018889f12e2a-f26f7a79-3fb3-4a71-b304-bf2aa152bf94-000000%40eu-central-1.amazonses.com.