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
{{ message }}
Repository navigation
Render takes increasingly long on large number of variables #490
I have a template with around 12.000 variables (text only) and rendering takes a whooping 27 minutes. Is there any way to speed up rendering? Thank you.
@gnadlr in docform, the maintained fork of python-docx-template, the last step of render was quadratic in lxml, and fixing it makes rendering linear: 12,000 variables take about 2 seconds in my tests (cvas22/docform#210). I could not reproduce 27 minutes with generated templates, so your template may have something else going on as well.
Activity
elapouya commentedon Apr 27, 2023
Did you try PyPy interpreter ?
cvas22 commentedon Nov 25, 2026
@gnadlr in docform, the maintained fork of python-docx-template, the last step of render was quadratic in lxml, and fixing it makes rendering linear: 12,000 variables take about 2 seconds in my tests (cvas22/docform#210). I could not reproduce 27 minutes with generated templates, so your template may have something else going on as well.