#18702: Remove chunked reads from iter(qs)
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  1.4
    Component:  Database layer       |               Resolution:
  (models, ORM)                      |             Triage Stage:  Design
     Severity:  Normal               |  decision needed
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 A rebased + squashed patch available from:
 
https://github.com/akaariai/django/commit/ddc85150d0bb82231e3820807f7652d2a9578ab2

 There were some changes to the queryset iteration lately (the introduction
 of _safe_iterator()). So, currently there are six nested iterators when
 iterating over a qs. This is getting a bit complex.

 Performance difference between the patched version and master for fetching
 ten objects from the DB using "for obj in qs" is 5%-7%. For
 values_list('pk') it is around 15%. So, there is a performance difference
 but it isn't too big.

 The silent discard of some exceptions should be fixed with the
 _safe_iterator() patch.

 Still, the code clarity difference is quite big. When considering this
 patch the question is mainly if there are some use cases where the
 "convert only some results to Python" is a big performance win. I don't
 believe such cases are common enough to care about, but then again I know
 mostly my own usage patterns... To me it seems that in most cases where
 the change would matter the user is doing something that will cause bad
 performance anyways.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18702#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to