Open js-jslog opened 4 years ago
https://github.com/js-jslog/harpnative/pull/51#discussion_r460397502
See the commit messages about this file in the pull request.
It's possible that the reason all of the HarpCells are given a rerender every time anything is done is because they receive the active ids along with all of the other harpstrata information.
It might be possible to shortcut some of the logic in the render by storing the matrices and the active ids separately in the global state and storing a value for the thisPitchId and thisDegreeId and choosing not to recalculate anything if they haven't changed.
This assumes that it is the usePositionAnalysis or something which is causing the lag at the moment.
More information on why so many rerenders might be occuring on harp cells: https://github.com/js-jslog/harpnative/pull/61#pullrequestreview-467606889
At this point we also have the problem that the menu's are driven by state in harpguru which is also the parent of harpface which means that harpface and all of its descendents get rerendered each time a menu is opened. It doesn't seem to be too much of a problem for performance at the moment, but I am testing of quite a powerful phone.
A simple memoization of the harpface, identifying the reactn states which are relevant to the harpface's rerendering would be sufficient.
Thoughts I've had about optimisation during other work from which I didn't want to get distracted