Hi Simon, thanks for the response.

I am still hoping however for someone to explain to me why the default
renderer cannot handle my use case, such as that a few hundred inputs is
too many, or that I am doing something else improperly.  Surely this kind
of a change would not be made to the framework that would cause such an
unacceptable performance (500+ms added). Kind of disappointing to spend a
whole week upgrading only to end up wanting to downgrade again.

I think your idea is a good workaround to explore if I cannot get any
answers, and I appreciate it. I did briefly try to set this up by setting
the default_renderer = renderers.Jinja2, but ran into some problems so that
will take more looking into.



On Fri, Dec 7, 2018 at 10:39 AM Simon Charette <charett...@gmail.com> wrote:

> Hello John,
>
> Did you try switching to the Jinja2 form renderer[0] to see if it helps?
> I've not
> tried it myself but I heard it makes a significant difference.
>
> Cheers,
> Simon
>
> [0] https://docs.djangoproject.com/en/2.1/ref/forms/renderers/#jinja2
>
> Le vendredi 7 décembre 2018 08:30:48 UTC-5, John a écrit :
>>
>> My site <https://www.morphmarket.com/> has a navbar with an advanced
>> search widget (beside the search field), which renders on every page. For
>> each request, a context_processor creates the form so it can be
>> available on that page in the navbar. This form has about a dozen selects
>> with a total of several hundred options. Most of those options are for the
>> currency and country selects, along with about 80 other options. There is
>> an even larger list for "stores" but it is loaded via AJAX so it should not
>> be a factor here.
>>
>> Performance was fine on Django 1.8, but after upgrading to 1.11 I noticed
>> with NewRelic that over 500 ms are now being used on my most frequent
>> request between the following:
>>
>>    - Render/django/forms/widgets/select_option.html
>>    - Render/django/forms/widgets/select.html
>>    - Render/django/forms/widgets/attrs.html
>>
>> [image: xDE2A.png]
>>
>> This seems to be related to 1.11's change to Template-based Widget
>> Rendering <https://code.djangoproject.com/ticket/15667> (docs
>> <https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#djangotemplates>),
>> however the only pages I could find talking about related problems were
>> about Django Toolbar which I do not run in production.
>>
>> I am and already using the Cached Template Loader (which is now default),
>> however I don't know if this helps here. I cannot easily cache this form
>> because as you can see in the code, I set a number of defaults based on the
>> request.
>>
>> Why is my form suffering so badly from this change? Eliminating two of
>> the bigger selects helps, but surely several hundred options should not
>> take this long to render so it seems to me there is an underlying problem
>> that the quantity is merely exacerbating.
>>
>> Here are links to to code for the full form and html. (I will include
>> snippets in the question later when we identify the problem, for future
>> readers).
>>
>>    - Search Form
>>    
>> <https://gist.github.com/jplehmann/b75379c12a37a6064f1face208d7dc88#file-search-py-L223>
>>    - Search HTML
>>    <https://gist.github.com/jplehmann/44872ab2c02da89080e9a199aed349ae>
>>    - Live Site <http://www.morphmarket.com/>
>>
>> Thank you in advance for your help!
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/uhe7ExBJoxg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b4a2a1d1-63e2-4a14-a5fa-2e75a018dadf%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b4a2a1d1-63e2-4a14-a5fa-2e75a018dadf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANRc4UNrqAyqHjqbJxJpPG-TPWUJmxeQ%2BQFOkJr%2BBFvCQVGqDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to