Skip to content

Conversation

@samouri
Copy link
Contributor

@samouri samouri commented Jan 11, 2018

summary
Conversations are dependent upon a single posts's comments and not the entire collection of comments. Therefore the current createSelector approach is less effective than it could be. This PR improves the performance by utilizing treeSelector.

I tested for fewer re-renders by using this unmerged performance tool.

below is the result of loading conversations and clicking "more comments" a couple times.

before
screen shot 2018-01-11 at 4 00 02 pm

after
screen shot 2018-01-11 at 4 43 25 pm


summary of results
By using treeSelect instead of createSelector I was able to get the wasted render count down from ~351 to 8. These numbers were just after a few second after loading -- I'm sure it would get wayy more drastic if i used conversations for much longer.

@matticbot
Copy link
Contributor

@samouri samouri changed the base branch from master to add/framework/create-cached-selector January 11, 2018 20:57
@samouri samouri self-assigned this Jan 11, 2018
@samouri samouri force-pushed the update/conversations-perf branch 2 times, most recently from 385b915 to ff11586 Compare January 15, 2018 23:36
@samouri samouri changed the base branch from add/framework/create-cached-selector to master January 15, 2018 23:37
@samouri samouri force-pushed the update/conversations-perf branch from ff11586 to 2ebbc76 Compare January 15, 2018 23:38
@samouri samouri added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 16, 2018
@samouri samouri requested a review from a team January 16, 2018 03:32
@samouri samouri added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 16, 2018
@bluefuton
Copy link
Contributor

bluefuton commented Jan 16, 2018

Nice one @samouri!

I'm seeing some failing tests for the getParentComment selector, caused by:

TypeError: Invalid value used as weak map key

@samouri
Copy link
Contributor Author

samouri commented Jan 16, 2018

The failing test raises an interesting question: what should treeSelect do when dependencies are undefined?

@samouri samouri added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 16, 2018
@samouri
Copy link
Contributor Author

samouri commented Jan 18, 2018

@samouri samouri added [Status] Blocked / Hold and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 18, 2018
@samouri
Copy link
Contributor Author

samouri commented Jan 18, 2018

blocked on merge of: #21625

@samouri samouri force-pushed the update/conversations-perf branch from 5b7b7d0 to 24adbd6 Compare January 18, 2018 01:01
@blowery
Copy link
Contributor

blowery commented Jan 19, 2018

@samouri i'd love to land this. Could you take a look at the failed tests?

@samouri
Copy link
Contributor Author

samouri commented Jan 19, 2018

Failed test should be fixed by #21625 which landed yesterday!
I've just rebased this PR, lets see if that does the trick

@samouri samouri added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 19, 2018
Copy link
Contributor

@blowery blowery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice work!

@samouri samouri merged commit d868831 into master Jan 23, 2018
@samouri samouri deleted the update/conversations-perf branch January 23, 2018 18:48
@sirreal sirreal removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Reader The reader site on Calypso. [Type] Performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants