You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before this commit `utils.second_pass_render` tried to unpickle stashed
context from all bits of content resulting from splitting of template by
`PHASED_SECRET_DELIMITER`. Only odd bits are results of `phased` block
rendering, so only those bits contain stashed context. Even bits can't
contain stashed context and since they are results of first pass
rendering they can be arbitrary long and even for content of sane length
searching for regular expression match done in `unpickle_context` can
take insanely long time.
Fixed by unpickling context only from odd bits.
Fixes: codysoyland#9
When
PhasedRenderMiddleware
is turned on, rendering time grows very fast with size of the content that is outside ofphased
block.For simple page that results in ~100 kB of HTML:
PhasedRenderMiddleware
inMIDDLEWARE_CLASSES
is rendered below 0.1 secondPhasedRenderMiddleware
it takes over 20 seconds on my machine to render.This slowdown is reproducible in many environments:
Steps to reproduce this problem:
example
project from django-phased repositorybase.html
template, outsidephased
blocke.g.
{% for _ in ""|ljust:"10000" %} some text {% endfor %}
just after<div id="body">
base.html
template e.g./blog/
The text was updated successfully, but these errors were encountered: