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
if you tell me the best way to generate useful performance reproduction I'll gladly do it
Describe the bug
we have fairly old school webpack react app, did migration from react-helmet to unhead according to migration guide, deployed it on prod and detected substantial latency increase for our ssr rendering (p50 90 to 160 ms). I don't know how unhead differs from react-helmet in terms of collecting tags, but I guess culprit is something in transformHtmlTemplate
Additional context
No response
Logs
Reacted by Soon, Dmytro Vasylenko, Bernhard Häussner, Aleksey Kovalevsky and Harlan Wilton
Thank you for this important issue and visibility on the performance.
You were right to suspect transformHtmlTemplate, this was the culprit, and further details are in #581.
Can you please try v2.0.15 and let me know how the performance improves? For large HTML pages, it should be about 10x faster.
I've also introduced transformHtmlTemplateRaw, it has the same signature but skips any pre-processing of the HTML. This is useful if you know the HTML will be pure (i.e not include possible duplicates & not include tags that need to be in a specific spot). Feel free to give it a try, I'll properly document it if it proves to be stable enough.
Activity
harlan-zw commentedon Sep 18, 2025
Thank you for this important issue and visibility on the performance.
You were right to suspect
transformHtmlTemplate, this was the culprit, and further details are in #581.Can you please try v2.0.15 and let me know how the performance improves? For large HTML pages, it should be about 10x faster.
I've also introduced
transformHtmlTemplateRaw, it has the same signature but skips any pre-processing of the HTML. This is useful if you know the HTML will be pure (i.e not include possible duplicates & not include tags that need to be in a specific spot). Feel free to give it a try, I'll properly document it if it proves to be stable enough.