#20950: Use OrderedDicts in ORM only when needed
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by akaariai):
I benchmarked the change that introduced OrderedDict (that is, commit
07876cf02b6db453ca0397c29c225668872fa96d). It seems the change introduces
around 15% slowdown in model_save_existing benchmark. Initializing an
empty OrderedDict is around 50% slower than Django's SortedDict was
(different algorithms, different tradeoffs).
Using Python's version of ordered dictionary is the correct thing to do. I
am pretty sure Python's OrderedDict will get optimised implementation some
day. But before that happens it seems like a good idea to avoid
initialization of empty OrderedDictionaries where possible.
--
Ticket URL: <https://code.djangoproject.com/ticket/20950#comment:1>
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/066.a4e45ccd8e80b222c73e3991b09a6fc4%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.