#36242: NodeList render overhead with huge templates
-------------------------------------+-------------------------------------
Reporter: Michal Čihař | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Uncategorized | Version: 5.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Michal Čihař):
Thanks for sharing this. I've seen improvement with my data, but
apparently, this depends on the actual content and I should have done more
research.
On short strings using list clearly wins:
{{{
(py3.14)$ python -m timeit '"".join([str(n) for n in range(1000)])'
5000 loops, best of 5: 79.8 usec per loop
(py3.14)$ python -m timeit '"".join(str(n) for n in range(1000))'
5000 loops, best of 5: 102 usec per loop
}}}
On long strings it is the other way around:
{{{
(py3.14)$ python -m timeit -n 1000 '"".join(["x" * 5000 for n in
range(1000)])'
1000 loops, best of 5: 3.27 msec per loop
(py3.14)$ python -m timeit -n 1000 '"".join("x" * 5000 for n in
range(1000))'
1000 loops, best of 5: 750 usec per loop
}}}
But it is more likely that there will be short strings handled in Django
templates.
--
Ticket URL: <https://code.djangoproject.com/ticket/36242#comment:2>
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/01070195817a509f-56b06afa-7465-49be-9fdc-45b0e1a82c19-000000%40eu-central-1.amazonses.com.