Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX --- optimization #41

Open
GuRuGuMaWaRu opened this issue Mar 25, 2018 · 3 comments
Open

FIX --- optimization #41

GuRuGuMaWaRu opened this issue Mar 25, 2018 · 3 comments
Assignees
Labels
fix fix it
Milestone

Comments

@GuRuGuMaWaRu
Copy link
Collaborator

It should rerender only when SIZE state is changes, I should not care about GAMEBOARD or MOUSEDRAG state

@GuRuGuMaWaRu GuRuGuMaWaRu added the fix fix it label Mar 25, 2018
@GuRuGuMaWaRu GuRuGuMaWaRu added this to the Fixes milestone Mar 25, 2018
@GuRuGuMaWaRu GuRuGuMaWaRu self-assigned this Mar 25, 2018
@GuRuGuMaWaRu GuRuGuMaWaRu changed the title FIX --- add shouldComponentUpdate to Gameboard component FIX --- optimization Mar 27, 2018
@GuRuGuMaWaRu
Copy link
Collaborator Author

Use shouldComponentUpdate or PureComponent to optimize performace --- rerender Gameboard component only when size changes (the only thing that matters for rendering gameboard as a whole), and remake Gameboard cells into separate components and have them rerender when their alive property changes.

@GuRuGuMaWaRu
Copy link
Collaborator Author

Look like replacing object-based gameboard structure with an array-based one didn't help.
If only there was a way to do the whole process differently.

@GuRuGuMaWaRu
Copy link
Collaborator Author

  • check for allDead during setInterval action
  • change alive-dead class of cells using classList instead of state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix fix it
Projects
None yet
Development

No branches or pull requests

1 participant