-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte Deeply nested SVG's cause lag #11405
Comments
Thanks for the repro! I tried testing it, but I'm not seeing the same... At most I'm seeing ~45ms presentation delay for all interactions, on both Mac (Safari/Chrome) and Windows (Chrome). |
I'm really sorry, I was in a rush to get to work when I posted this. It's only happening on Mobile for me, Android. The screenshots are from running it from my Android phone connecting to my computer over wifi |
I just tried on iPad (Physical Device) and iPhone (Simulated) but it's not happening on those. |
also reported here unplugin/unplugin-icons#357 (please mention cross-links in the future to avoid duplicated work) from the comments there it appears you are using lots of event handlers. Can you provide a minimal reproduction and upload the full trace to show where time is spent instead of just a screenshot? |
I Re-created the exact same scenario but in React, it's also not very quick but it's quicker than svelte: |
I've added buttons for rendering pngs: SaintPepsi/unplugin-icons-performance-issue-minimal-reproduction@0e70a4e They don't have any performance issue besides the normal delay of loading the image. Are SVG's just really expensive to render? |
Please can you create an example on the REPL? this is far easier for us to debug and track. It might be that we can apply some optimizations in some places, or are missing them entirely. |
No Worries @trueadm, The REPL: The Fiddle: In the Svelte REPL if you click on "Show Multiple Complex Exploding Head SVG"'s button, 10 SVG's get rendered If you look at the fiddle, The tasks of duplicating each node and then I hope this is enough information to help out If there's more alternative examples that you'd like me to provide please let me know. The issue has now transcended my mobile phone, it's obvious that phones score worse in performance. As these tests were replicated on my computer |
I know that the obvious solution here is "Don't use complex SVG's as images, just use a png" but I do think it's an interesting problem, and it could highlight other problems that might arise in the future, i've been committed to svelte for a couple of years now and i'm building my first Production application with it and as the complexity of my projects has been increasing as I get familiar with Svelte over the years I discover interesting kinks that are hard to spot in smaller applications that i'd love to help iron out, since i'm new to contributing I just need some extra guidance 🙇♂️ Love you @Rich-Harris |
@SaintPepsi Svelte 5 doesn't trigger any |
@trueadm I noticed that as well yes. On my computer it's fine, but on Android it's quite slow. I spoke to @khromov and he mentioned there's an open chromium ticket for it too https://bugs.chromium.org/p/chromium/issues/detail?id=1289741 Seeing that svelte 5 does not have this issue and if all it is at the moment is a chromium bug then maybe this can be closed and an alternative solution should be explored like png's. Thanks in any case for participation 🙂 |
I'm going to close this, because the thing that is actually causing any sort of lag on svelte's side is fixed in Svelte 5 like @trueadm mentioned :) thanks again everyone |
Describe the bug
When SVG elements are rendered to the page it causes a big performance slow down.
Parsing the HTML happens instantly, but then there is a presentation delay of over 500 ms
Reproduction
https://github.com/SaintPepsi/unplugin-icons-performance-issue-minimal-reproduction
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: