Changes between Initial Version and Version 1 of Ticket #20880


Ignore:
Timestamp:
08/08/13 13:37:27 (9 years ago)
Author:
Anssi Kääriäinen
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20880

    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #20880 – Description

    initial v1  
    11QuerySet and Query clone() methods are doing more than just cloning, they are also doing set up for next operation, changing the class of the clone if requested, and even throwing away some attribute values.
    22
    3 To make the code a bit more readable the clone() the preparation for next op should be splitted away to pre_next_op() method. This also allows creating inplace querysets that work precisely like full-clone querysets (inplace queryset doesn't do cloning at all). This again allows speeding up certain internal operations (like model.save() and prefetch_related()), and also allows users to optimise heavy-to-create querysets by avoiding clone() overhead.
     3To make the code a bit more readable the clone() method should be splitted to clone() part and pre_next_op() part. This also allows creating inplace querysets that work precisely like full-clone querysets. A queryset is called inplace if it doesn't do cloning at all between operations. This again allows speeding up certain internal operations like model.save() and prefetch_related(), and also allows users to optimise heavy-to-create querysets by avoiding clone() overhead.
    44
    55Patch available from https://github.com/akaariai/django/tree/splitted_clone. The inplace queryset used for Model.save_base() speeds up model.save() by about 20% for a simple m = Model.objects.get(); m.save() benchmark. There are other places where similar optimisations could be used. Prefetch speedup is tracked in ticket #20577.
Back to Top