id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 27624,Optimize ORM by using more immutable data structures,Adam Johnson,Adam Johnson,"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.). ",Cleanup/optimization,assigned,"Database layer (models, ORM)",1.10,Normal,,,me@… Keryn Knight,Accepted,0,0,0,0,0,0