BetterWorks / django-anonymizer

MIT License
14 stars 12 forks source link

add generator to reduce memory usage #7

Closed danielcmartin closed 8 years ago

danielcmartin commented 8 years ago

when working with large amounts of data django iterator still uses too much memory , added a generator that chunks the queryset, using less memory at the expense of making more db queries.

taken from: http://stackoverflow.com/questions/4222176/why-is-iterating-through-a-large-django-queryset-consuming-massive-amounts-of-me

danielcmartin commented 8 years ago

locally this was using an order of magnitude less memory, from > 1GB to ~100MB

terite commented 8 years ago

This improvement makes sense to me. I don't have a strong preference for the comment I made; I just had to think about why it felt strange.

LGTM

danielcmartin commented 8 years ago

i liked your improvement @terite, code is updated.

bradyoo commented 8 years ago

LGTM