Open cborchert opened 5 years ago
Looking closer at this issue, it seems like we can improve the perf of the render method of Cube.js.
Notably, the scene and the cube are sharing a render method so all updates in the scene styles are causing the cube to rerender. Some ideas:
1) The cube and the block rendering could be memoized. This might actually be a costly operation since the block state is a deep object, so I'm not sure it would help. Things that need to be compared on the block level are: faces
(object), rotateX
, rotateY
, and rotateZ
;
2) Things could be broken out into separate components (just as a general refactor), and, while we're at it, we could use a portal to insert the cube into the scene which isn't actually its parent to prevent rerenders
Essentially idea two would mean going from this
App
Scene
Pivot
Cube
to this
App
Scene
Pivot
CubePortal
CubeInstance
Where the cube instance is not a direct child of Scene.
Does useGesture need to be debounced? It's definitely locking up.
In general, perf needs to be worked on. Make some extra tickets concerning bottle necks and expensive operations.