#36732: Sitemaps with i18n=True load the whole table in memory
-------------------------------------+-------------------------------------
     Reporter:  Julien Palard        |                     Type:
                                     |  Cleanup/optimization
       Status:  new                  |                Component:
                                     |  contrib.sitemaps
      Version:  5.2                  |                 Severity:  Normal
     Keywords:  sitemap, memory      |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 Hi!

 It's a bit like: https://code.djangoproject.com/ticket/11572

 when enabling i18n on a sitemap, _items uses the following code:

 ```python
             # Create (item, lang_code) tuples for all items and languages.
             # This is necessary to paginate with all languages already
 considered.
             items = [
                 (item, lang_code)
                 for item in self.items()
                 for lang_code in self.get_languages_for_item(item)
             ]
 ```

 The list comprehension loads the whole table times the number of languages
 in memory.

 We tried with a table containing two millions elements and two languages:
 it does not fit in 16GB of memory and the process gets killed.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36732>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019a829ed48a-cc652569-c2ca-415e-90c6-d5938fc8cf4e-000000%40eu-central-1.amazonses.com.

Reply via email to