#27624: Optimize ORM by using more immutable data structures -------------------------------------+------------------------------------- Reporter: Adam | Owner: Adam Chainz Chainz | Type: | Status: assigned Cleanup/optimization | Component: Database | Version: 1.10 layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- Django's `QuerySet` and `Query` classes spend most of their lifetime being copied, and each step in the building of a query, a very limited selection of the attributes get changed. As such they incur time and memory overheads from using mutable datastructures that require a copy operation for each step. Mutable data structures also introduce the possibility for bugs if they get shared or mutated in the wrong places. Finally `QuerySet` and `Query` are inconsistent and mix mutable and immutable datastructures for similar attributes.
I'm going to look at converting them to using just immutable ones (tuple instead of set, frozenset instead of set, etc.). -- Ticket URL: <https://code.djangoproject.com/ticket/27624> 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. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.1788efd5947abf05b70d43f57efa3dac%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.