-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Horrible performance when using flexRender() #4962
Comments
I forgot to mention that I also tried to profile it when using |
@sledgehammer999 any updates on this one? |
@skokenes Nope. I am a JS and Svelte noob. I was hoping someone from the team to solve this. |
For me the same. React + ChakraUI and I have a table with 280 rows. If I use |
I have noticed the same problem. Even on small tables with 300 rows. But also have no idea how to fix this :( |
I have a workaround. Instead of doing <svelte:component this={flexRender(cell.column.columnDef.cell, cell.getContext())} /> I've started doing (https://github.com/twinstar-bosskills/twinstar-bosskills/blob/79c7c4a4ea4e5aa27d131a745871847a775f353c/src/lib/components/table/Table.svelte#L125) <svelte:component this={result.component} {...result.props} /> where You can check usage here - https://github.com/twinstar-bosskills/twinstar-bosskills/blob/79c7c4a4ea4e5aa27d131a745871847a775f353c/src/routes/%5B%5Brealm%3Drealm%5D%5D/boss-kills/%2Bpage.svelte#L74 I have not found any problems with this workaround but there might be some. |
Describe the bug
I am using the "sorting" example code for svelte as a basis.
The main issue is that the UI response is horrible for simply sorting a table.
It takes about 4 seconds to sort a table of 1'000 rows with flexRender().
Without flexRender() it instantaneous.
I am a web dev noob. I mainly do C++. I have no idea why the slowdown or how to fix it.
I hope that more knowledgeable people here can look into this and solve it.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/modest-voice-mxlcvx?file=%2Fsrc%2FApp.svelte%3A138%2C100
Steps to reproduce
I have modified it a bit to simplify the performance measurements:
Here is my codesandbox fork with the changes.
Click on a header to sort the table.
With
it takes about 1760 ms to update according to the measuring function. If you count yourself, it takes about 4 seconds to visually update the table.
However changing the above code to
it takes about 18 ms to update according to the measuring function.
That's more than 200x performance gain!!! (4 seconds visual update as basis).
Expected behavior
Snappy UI with instant table sorting.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Win 10, Firefox 114.0
react-table version
8.9.4
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: