Django 1.11 slow ChoiceField rendering
See original GitHub issue- Package version: 1.6.1
- Django version: 1.11
- Python version: 3.6.1
Description:
I just upgrade to Django 1.11 and I noticed that in a specific form that we render timezones from pytz.common_timezones
(currently 439 items) I’m getting error 503. After some tests, it seems that rendering ChoiceFields
is extremely slow. If i trim the list down to a few items (<100) the form is displayed in a reasonable time. So I replaced the code for something like forms.ChoiceField(choices=[('test', 'test')] * 100)
and the response time increases almost exponentially by the number os itens in the list.
Downgrade to 1.10.7 and everything is fast as always.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Poor Performance for Form Rendering In Django 1.11
If you have truly isolated the widget rendering as the performance bottleneck, ... ChoiceField(choices=XXX, widget=OptimizedSelectWidget).
Read more >[Answered]-Django render is very slow-django
This is my training django project. I am using GeoIP, django-modeltranslation, i18n. Showing video gallery page is very slow. The database contains about...
Read more >Degraded performance when rendering ChoiceField with lots ...
One ChoiceField with 1k options took 6s instead of 0.5s after updating to django 1.11 with DEBUG=True. apollo13 created a reduced test case:...
Read more >forms - Simple is Better Than Complex
How to Implement Grouped Model Choice Field Jan 2, 2019 • 6 minutes read • 12 comments • views; Advanced Form Rendering with...
Read more >PDF - Django Documentation
1.11 Internationalizationandlocalization . ... from django.shortcuts import render ... Doing the following is potentially quite slow:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mdalpi Do you have the Django Debug Toolbar enabled while testing this? I had the same problem, and finally found that disabling DDT solved the problem. See
https://github.com/jazzband/django-debug-toolbar/issues/910
Wow, I was about to downgrade to 1.10 because of this. Indeed DDT is the culprit. Thanks for bringing this up @mdalpi and thanks @xbello for the solution!