#16759: Expensive sql.Query cloning
-------------------------------------+-------------------------------------
     Reporter:  Suor                 |                    Owner:  Suor
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  orm performance      |      Needs documentation:  0
  cloning                            |  Patch needs improvement:  1
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 And now I remember what the strangeness was. Trees are created by starting
 subtrees. When you start a subtree for tree node A, you modify the tree
 inplace, such that references to A now point to the new subtree root, and
 that subtree root has A in subtree_parents.

 That API is really strange. You basically have some sort of global state
 for the tree. You can not store a reference to a tree's root node. If
 somebody, somewhere calls start_subtree() on the root node, you suddenly
 have a reference to a new empty subtree of that root. The root node was
 mutated inplace. The tree API is changed to something simpler and more
 conventional in #17025. But changing the tree representation should not be
 done for 1.4.

 In short, the subtree_parents cloning in tree.clone() should be changed to
 assert not self.subtree_parents. When cloning you must start from the real
 tree root, and in that case no node in the tree should have
 subtree_parents.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16759#comment:22>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to