On 03/14/2011 08:49 PM, Alexander Schepanovski wrote:
> Personally, I would like all querysets mutate not clone by default.
> And when one need a clone just make it explicitly.
This is not an option. It will break quite a lot of existing code, and
often in highly confusing ways. You'll need to find other ways to
optimize. I'd be surprised if the cloning of querysets is actually a
significant bottleneck relative to the database query itself, unless
you're doing loops with hundreds or thousands of clones, in which case
it can almost certainly be optimized via Q objects.
If you really think it will make a significant difference for your app,
you can probably achieve this for yourself by using your own subclass of
QuerySet and overriding the _clone method.
Carl
I have seen this in my app, too. It still runs fast enough. But
I guess the django code could be optimized.
Thomas
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de