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 15283,A performance imporvement for QuerySet,lanyjie,nobody,"Since the __len__ method of class QuerySet is called quite frequently (for example, as p art of list(qs), we make some effort here to be as efficient as possible whilst not messing up any existing iterators against the QuerySet. In the implementation of that method, I noticed a performance improvement, which is very simple to do. The last three lines of code was: {{{ elif self._iter: self._result_cache.extend(list(self._iter)) return len(self._result_cache) }}} which involves the creation of a list to pass as an argument to the extend() method. Clearly this is not necessary as the extend() method takes an iterable, and self._iter is already iterable, so that can be simplified without creating the list, which should result in improved performance both in speed and in memory use. Here is the improved code: {{{ elif self._iter: self._result_cache.extend(self._iter) return len(self._result_cache) }}} ",,closed,"Database layer (models, ORM)",1.2,,fixed,QuerySet performance,,Ready for checkin,1,0,0,0,0,0