I am working on a version of The Game of Life in the reaction / redux / javascript, while it works for me, the performance is terrible.
Here is the link to the current game. Here is the source of githhub
At the moment, I am on every tick (250 500 750 ms, user-modifiable), updating the state of each cell. To do this, I iterate over an array of objects representing each cell. Inside each object there is a parameter called status, which can be an integer of 1 for living or 0 for dead.
Then I draw three rows of three cells for the above middle and lower rows around the cell in question, then sum these values ββ(excluding the cell itself in the center).
Then I run this number through the if / then stream to determine the new state of this cell.
This process is then repeated for each individual cell in the application. After that, the new state of each cell is sent using abbreviations and component updates as necessary.
In actual view, each cell is a reaction component that takes it as a support from a container that is a grid. I have the shoulComponentRender () setting only to re-render the cell when its life status changes.
I think that when profiling the application (which I am not very clear / good), it is the process of calculating all the values ββthat slow down, but I can be wrong, and these may be the React components that cause the problem.
Any help / help appreciated!
source share