Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Improve performance by using shouldComponentUpdate #122

Closed
linclark opened this issue Jul 12, 2016 · 6 comments
Closed

Improve performance by using shouldComponentUpdate #122

linclark opened this issue Jul 12, 2016 · 6 comments

Comments

@linclark
Copy link

Currently, we are calling render on each message instance with each state change. This is a pretty big performance hit as the array of messages gets larger. If we used keys and shouldComponentUpdate, then only the messages that had changed would go through render.

For the key, we may want to add an autoincremeting ID in utils/messages.js

@linclark linclark added this to the phase 1, sprint 2 milestone Jul 12, 2016
@bgrins
Copy link

bgrins commented Jul 12, 2016

So what is the component(s) that should have the shouldComponentUpdate implementation? And should it be comparing keys on the old and new messages?

@linclark
Copy link
Author

We should be able to do the shouldComponentUpdate on the MessageContainer and it should just be able to check the repeat prop.

The key would be added where we create the array of messages.

@bgrins
Copy link

bgrins commented Jul 13, 2016

@pelmers is working on this one

@pelmers
Copy link
Collaborator

pelmers commented Jul 15, 2016

Some test-writing progress in #128

pelmers added a commit to pelmers/gecko-dev that referenced this issue Jul 15, 2016
@linclark
Copy link
Author

@pelmers thanks for posting the WIP, and I'm so excited to see the test in there! it will be great if we can get numbers on the kind of improvement this provides.

@linclark linclark changed the title Improve performance using keys and shouldComponentUpdate Improve performance by using shouldComponentUpdate Jul 18, 2016
@bgrins
Copy link

bgrins commented Jul 18, 2016

Closed by #128

@bgrins bgrins closed this as completed Jul 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants