Open remusris opened 1 year ago
@remusris one optimization that I think it's worth doing is to remove these two instructions from the nodeCanvasObject
method:
const nodeImg = new Image();
nodeImg.src = node.img;
You're better off pre-generating those image objects instead of repeatedly at every frame in the nodeCanvasObject
method.
If you still have issues after that, it would be better if you can create a simple repro example at https://codesandbox.io/.
@vasturiano I used your suggestion and it significantly improved the performance, thanks for the pointer. If I do run into any more performance issues, I'll follow up once more.
@remusris Where did you put
const nodeImg = new Image(); nodeImg.src = node.img;
How can I pre-generate outside nodeCanvasObject? @vasturiano
Can you please elaborate further? It will surely help.
Thanks
Describe the bug Frame rates begin to drop once I get a couple hundred custom 2D nodes. I'm rendering url favicon PNGs captured from browsing history.
To Reproduce This is the example code snippet. I'm querying from a firebase collection.
graphData2 is there to show how the node data is being structured, the "img" property is a faviconURL link. The firebase query has far more nodes.
Expected behavior There seems to be some stuttering, I'm not sure if it's the way that I'm querying firebase that's causing it causing a bunch of re-renders or some type of optimization in terms of caching.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): Google Chrome | 111.0.5563.111 (Official Build) (64-bit) (cohort: Stable) Windows 11 Version 22H2 (Build 22621.1413)
Additional context Add any other context about the problem here.