Opened 12 years ago

Closed 12 years ago

#19276 closed Cleanup/optimization (fixed)

ORM performance regression between 1.4.x and 1.5.x

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5-alpha-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I did some benchmarking for performance regressions between 1.4 and 1.5 (using Python 2.6.7 and djangobench). I found that nearly every ORM benchmark for djangobench has regressed about 10%. I made a time series of one benchmark (query_annotate), available here: http://users.tkk.fi/~akaariai/djbench/query_annotate.html

There are two commits which show up in the graph:

It seems there is some low-hanging fruit especially for the second commit, see here: https://github.com/akaariai/django/compare/orm_perf

Change History (7)

comment:1 by Anssi Kääriäinen, 12 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

One more regression spotted - query_select_related got hit by the above regressions + another change made for fixing Oracle in select_related cases. Commit: c159d9cec0baab7bbd04d5d51a92a51e354a722a, graph here: http://users.tkk.fi/~akaariai/djbench/query_select_related/

A patch for the select_related case is available here: https://github.com/akaariai/django/compare/fix_select_related_perf (the reason for the regression was the repeated access to connections[using], the fix dodges this and makes the code a little cleaner, too).

I am elevating this to release blocker. While the regressions aren't really that severe, it is a good idea to check if we can easily fix the performance regressions before the final release. If not, then lets just close this ticket. So, release blocker as in "lets not forget to check this before release".

comment:2 by Anssi Kääriäinen, 12 years ago

Triage Stage: AcceptedReady for checkin

I did a little more work, and now I have RFC stuff in https://github.com/akaariai/django/compare/ticket_19276

comment:3 by Anssi Kääriäinen <akaariai@…>, 12 years ago

In fa18b0ac89723f4ed6e46e744039bf375c8945a5:

Some changes to SortedDict to make it faster under py2

Refs #19276

comment:4 by Anssi Kääriäinen <akaariai@…>, 12 years ago

In ce1af8d7023f02e4521cce3bcdbc9fd13d76c5f8:

Removed use of SortedDict for query.alias_refcount

This will have a smallish impact on performance. Refs #19276.

comment:5 by Anssi Kääriäinen <akaariai@…>, 12 years ago

In 538d6c0fcd7e0a5505aa4d0424edc823ce2f511f:

Some changes to SortedDict to make it faster under py2

Refs #19276

comment:6 by Anssi Kääriäinen <akaariai@…>, 12 years ago

In fe21c233d44a5cafff0766eb17ed3df20e08b70f:

Removed use of SortedDict for query.alias_refcount

This will have a smallish impact on performance. Refs #19276.

comment:7 by Anssi Kääriäinen, 12 years ago

Resolution: fixed
Status: newclosed

OK, it seems the regressions are now fixed, see: http://users.tkk.fi/~akaariai/djbench/query_select_related/ and http://users.tkk.fi/~akaariai/djbench/query_annotate/ (the last commits are barely visible in the right, but they are there...).

Note: See TracTickets for help on using tickets.
Back to Top