#20950: Use OrderedDicts in ORM only when needed
-------------------------------------+-------------------------------------
               Reporter:  akaariai   |          Owner:  nobody
                   Type:             |         Status:  new
  Cleanup/optimization               |        Version:  master
              Component:  Database   |       Keywords:
  layer (models, ORM)                |      Has patch:  1
               Severity:  Normal     |    Needs tests:  0
           Triage Stage:  Accepted   |  Easy pickings:  0
    Needs documentation:  0          |
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Initializing OrderedDicts seem to be really slow, at least on Python 2.7.
 By instantiating OrderedDicts in Query only when needed one can save
 considerable time. For example model_save_existing benchmark is 1.3x
 faster, qs_filter_chaining 1.35x faster. Nearly all of the query_
 benchmarks have at least 10% speedup.

 Patch at https://github.com/akaariai/django/tree/ordered_dict_on_need.
 Together with splitted_clone branch this gives over 1.5x speedup to
 model_save_existing.

 There might be some cleaner way to implement the "initiate only on need"
 for Query._aggregates and Query._extra. Ideas welcome.

 Ill accept this directly as this seems like a good idea to do. This trades
 code-cleanness for performance, but in this particular case I think it is
 worth it.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20950>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.a6a867867f93c867c4d5da917ffeddb9%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to