question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SplitLinePath takes a long time to render with certain curves

See original GitHub issue

For some reason, <SplitLinePath> is taking a long time to render when paired with certain curves.

Reproduction:

https://stackblitz.com/edit/react-ts-mgzfrj?file=App.tsx

Open the above link in a new tab and react profiling tools and you will see that the render is taking a long time (>100ms on a new M1 Mac)

Screen Shot 2022-10-25 at 12 22 19

This only seems to occur for smooth curves like curveMonotoneX, curveNatural and curveCardinal.

This only seems to affect <SplitLinePath> while rendering the same data with the same curves as two separate line paths only takes a couple of milliseconds.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
valtismcommented, Oct 26, 2022

Yeah, that’s the plan. Already implementing it in our codebase right now. I can share the end-result when I’m done. It could be exposed as a new shape, like <PerformantSplitLine> or something in Visx.

Hope to find a way to make this compatible with all curves too

0reactions
valtismcommented, Oct 27, 2022

So this is a rough solution I have to meet our use-case: https://gist.github.com/valtism/5a6265b503aa7a7ae2a765f0d11163cf

One of the main differences is that this approach no longer relies on exact matching of points (which is impossible with some curves) and instead uses the getClosest function to find the closest x point in the path to the target. It now mostly works for all types of curves (although not yet for closed curves).

This was only set up for x segmentation, but could be extended fairly easily to support both x and y. I haven’t though about how length would work, because we really only need x segmentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · airbnb/visx - GitHub
SplitLinePath takes a long time to render with certain curves perf @visx/shape. #1591 opened on Oct 25 by valtism.
Read more >
Curves - RenderMan 24 Documentation
This geometry type is an approximate representation, designed to render more efficiently in both time and memory compared to an equivalent ...
Read more >
I have to visualize a ton of curves, how can I make ... - Reddit
Even with low resolution (1 or 2) in the geometry tab, the collection of curves are still taking an unreasonably long time to...
Read more >
Save and setup dynamic curves for rendering | Maya 2018
Click beside Wires File and browse to the location of your saved Alembic file. XGen uses this cache file to animate the curves...
Read more >
MODO Octane | Rendering Curves - YouTube
Render MODO curves in Octane with the help of Curve Tracer X and a few nodes (rebuild curve ... Also, the audio sucks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found