Skip to content
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

Performance issues with large amount of data #69

Open
mcharnet opened this issue Dec 24, 2024 · 6 comments
Open

Performance issues with large amount of data #69

mcharnet opened this issue Dec 24, 2024 · 6 comments

Comments

@mcharnet
Copy link

Hi @dnass,

Thanks again for having upgraded to Svelte 5. I finally got time to test it on my project. Everything is working well with most of my charts, but I have some issues with reactive rendering on ones that display a large amount of data (~20000 points). It was perfect with svelte-canvas v1.0 but since the bump, there is a lag when I want to hover a point and change reactively opacity of the others. Would you have an idea of what could cause this within the update?

Thanks,
Marine

@dnass
Copy link
Owner

dnass commented Dec 24, 2024

Hi, any chance you could share a reproduction of the issue?

@mcharnet
Copy link
Author

Hi,
Thanks for your quick reply. Here is a minimal reproduction of my code : https://svelte.dev/playground/411322c99faa47129aad018574a04d21?version=5.15.0

Thanks for your help !

@dnass
Copy link
Owner

dnass commented Dec 27, 2024

I don't totally understand why this issue is happening, but I found that the performance improves a lot if you precompute the x and y coordinates instead of calling xScale and yScale inside the render callback. Here's how you can do that.

I'll keep looking into this to see if there's something I can fix in the library, but in the meantime, let me know if this solution works for you.

@mcharnet
Copy link
Author

Thanks for taking the time to take a look. Unfortunately, this change doesn't improve so much the performance in the real app.. Moreover, I noticed another issue with my boxplot, points are not even rendered (https://svelte.dev/playground/a921fbc5d3374ac1a5f942c629d54098?version=5.16.0).

I'm trying too on my side, let's keep in touch if we find something !

@dnass
Copy link
Owner

dnass commented Dec 27, 2024

There are a couple reasons the boxplot example isn't working:

  • The canvas is inside the SVG, which is invalid.
  • You're calling the scale functions on the data twice, first in reactivePointsScaled and then in points.

@dnass
Copy link
Owner

dnass commented Dec 27, 2024

In the production version of the cluster viz, are there any other calculations happening in the render function that could be moved outside?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants