Opened 15 years ago

Closed 15 years ago

#11181 closed (wontfix)

Make save faster

Reported by: novalis Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Save presently does a bunch of work each time to set up a manager for update. This can be cached. A patch is attached.

Attachments (1)

faster-inserts-by-caching-manager.patch (1.2 KB ) - added by novalis 15 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Honza Král, 15 years ago

Resolution: wontfix
Status: newclosed

Constructing a queryset every save() (which your patch doesn't avoid) is not such an expensive operation that it would require caching.

If you feel the need to do this in your model, do it in your save method and use the outcome to set force_insert or force_update.

comment:2 by novalis, 15 years ago

Resolution: wontfix
Status: closedreopened

It is in fact a fairly large percentage of the time for save in my benchmark. My case is perhaps unusual in that my model has a default ordering, but I think this is fairly common.

I can't do it in my save method, I think, because that doesn't work when I am loading fixtures. So this patch makes tests faster as well as the live site.

comment:3 by Alex Gaynor, 15 years ago

Resolution: wontfix
Status: reopenedclosed

An attribute lookup *is not that expensive* which is all this patch is doing. Marking as wontfix again, if you disagree please take this to the django-developers mailing list.

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