SplitLinePath takes a long time to render with certain curves
See original GitHub issueFor 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)
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:
- Created a year ago
- Comments:10 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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 closestx
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 bothx
andy
. I haven’t though about howlength
would work, because we really only needx
segmentation.