#35102: Performance regression on Model.objects.count() between Django 4.2 and
5.0
-----------------------------------------+------------------------
Reporter: Anthony Shaw | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I was running the djangobench tool against the 4.2 and 5.0.1 tags (and
main to verify) and noticed that some of the benchmarks had significant
regressions.
The one I wanted to highlight is `query_count`. The other two with
regressions were model creation and query_annotate.
`djangobench --control 4.2 --experiment 5.0.1 query_count -p profiles`
The profile for both versions shows that in v5, get_aggregation has an
additional call to replace_expressions which spends a lot of time in the
slow inspect module. In the profile reports I collected this accounts for
the 30-40% performance regression on the count aggregation query.
Performance regressions with new features are expected, but I wanted to
raise this because the [ASV environment for
Django](https://github.com/django/django-asv) seemed to have missed some
of these regressions when all of the benchmarks suddenly ran faster.
I've attached profiles for 4.2 and 5.0.1 which can be opened using
something like snakeviz
--
Ticket URL: <https://code.djangoproject.com/ticket/35102>
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/0107018cf7225367-d3320fe8-2138-4014-852f-b3fc84867716-000000%40eu-central-1.amazonses.com.