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 #74
Copied from python-docx-template issue 490, opened by @gnadlr on 2023-04-27.
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 found a big part of it: replacing the document body at the end of render took quadratic time in lxml, so large templates got slower and slower. Fixed in #210, rendering is linear now and 12,000 variables take a couple of seconds in my tests. I could not get anywhere near 27 minutes with generated templates though, so if it is still slow for you, attach the template (with dummy data) and I will reopen.
Activity
cvas22 commentedon Nov 25, 2026
@gnadlr found a big part of it: replacing the document body at the end of render took quadratic time in lxml, so large templates got slower and slower. Fixed in #210, rendering is linear now and 12,000 variables take a couple of seconds in my tests. I could not get anywhere near 27 minutes with generated templates though, so if it is still slow for you, attach the template (with dummy data) and I will reopen.