How to optimize complex svelte components for faster loading ? #11765
Replies: 3 comments 7 replies
-
I don't think there is much you can do about the basic operations. Regarding the data handling, some data grids allow doing most work on the server (or by extension the DB) and only ever send the current page to the client. One of the most common UI optimizations is virtualization. This entails only creating the elements that are currently in view; you can also potentially reuse old elements for newly visible items. This is a fairly involved process, though, especially if items should be allowed to have variable sizes. It can also involve more direct DOM interaction which has to happen outside the regular Svelte syntax. |
Beta Was this translation helpful? Give feedback.
-
There are table components for Svelte that try to squeeze out the max possible performance. See e.g. https://svelte-headless-table.bryanmylee.com/ One of the limitations of Svelte 4 that they are addressing with Svelte 5 is the ability to do fine grained updates in |
Beta Was this translation helpful? Give feedback.
-
Here's another new Svelte 5 table component that looks promising: https://github.com/WJSoftware/wjfe-dataview |
Beta Was this translation helpful? Give feedback.
-
Hi Community,
I'm new to Svelte, and I built a data grid with Svelte. It handles certain complex operations, and I just realized it may have linear complexity if the data source is large (Initial Data Loading: O(n), Filtering/Searching: O(n), Pagination Calculation: O(1), and so on). I wonder if there are any ways to optimize it to render super fast, or if there are any best practices I should follow. I'm also sharing the code for more context.
Sample Code
Thanks
Beta Was this translation helpful? Give feedback.
All reactions