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
The rendering performance of interweave significantly drops as the number of nested elements increases. I noticed an exponential slowdown in rendering performance as the depth of HTML approaches 20. Performance is further reduced when a transform function is provided.
To render a depth of 15, it took ~90ms
To render a depth of 21, it took ~5s (55x longer)
Sample HTML for clarity/ease:
<divid="1"><divid="2"><divid="3"><divid="4"><divid="5"><divid="6"><divid="7"><divid="8"><divid="9"><divid="10"><divid="11"><divid="12"><divid="13"><divid="14"><divid="15"><divid="16"><divid="17"><divid="18"><divid="19"><divid="20"><divid="21">
Test
</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
The text was updated successfully, but these errors were encountered:
This is interesting, I copy/pasted your nested code example into my project that uses Interweave and I'm not seeing any performance issues. I'm running it locally (React-Typescript-Vite) and the compiled code on the my server (Cloudfront/S3 web server) and the load times are nearly identical to when I don't include that block of nested divs.
@overtureweb can you please provide some info about your configuration:
version of interweave
usage of transform
I just ran into the same problem using [email protected] and [email protected], a simple transform function and a string containing HTML with a nesting depth of 36. The increase in CPU usage without transform is not as bad as with it.
It crashed our infrastructure because the node application pods kept restarting over and over again 😱 And it was hard to debug 😵💫
The rendering performance of interweave significantly drops as the number of nested elements increases. I noticed an exponential slowdown in rendering performance as the depth of HTML approaches 20. Performance is further reduced when a
transform
function is provided.I've attached a sample app to demonstrate the issue with very simple HTML and an empty transform function
https://replit.com/@Xapphire13/Interweave-Transform-Bug#src/App.tsx
To render a depth of 15, it took ~90ms
To render a depth of 21, it took ~5s (55x longer)
Sample HTML for clarity/ease:
The text was updated successfully, but these errors were encountered: