But what changed in 1.2 vs. 1.1 that caused cloning to become slower? Is it fixes for correctness that were missing?
And if 1.3 is slower than 1.2, why the slow down there? If the slowness is for a good reason (correctness is about the only one I can think of that is really valid), then fine. But if the slowdown is just because it is slower and no one knows why, let's add a performance test for cloning and make sure Django does not slow down (yeah, this is a hand wave as performance is a tough thing to maintain, but well worth the effort). Also, just simply creating a DB object is slower with get_or_create. See attached script that I used to harp on 1.1 vs. 1.2.5 (slightly modified to change the names, etc. and requires a proper django view to work). I ran this against both sqlite and mysql. -peter On Mon, Apr 25, 2011 at 9:36 PM, Alexander Schepanovski <suor....@gmail.com>wrote: > > Is there a way to identify which queries use cloning? > > Every filter, exclude, order_by, select_related and some other calls > clones it. Slicing too. > > > Is there a way rewrite those queries to avoid cloning overhead? > > You can rewrite > qs.filter(a=1).exclude(b=2) as qs.filter(Q(a=1) & !Q(b=2)) > or > qs = qs.filter(a=1); ...; qs = qs.filter(b=2) as q = {}; q['a'] = > 1; ...; q['b'] = 2; qs = qs.filter(**q) > > But you can't avoid several cloning procs for queryset not modifying > django or monkey patching. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
pound.py
Description: Binary data