Page MenuHomePhabricator

[native] Memoize `swipeableThread` in `ChatThreadListItem`
ClosedPublic

Authored by atul on Sep 7 2023, 11:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 10:55 PM
Unknown Object (File)
Fri, Nov 22, 7:29 AM
Unknown Object (File)
Thu, Nov 21, 6:51 AM
Unknown Object (File)
Thu, Nov 21, 6:51 AM
Unknown Object (File)
Thu, Nov 21, 6:51 AM
Unknown Object (File)
Thu, Nov 21, 6:50 AM
Unknown Object (File)
Thu, Nov 21, 6:45 AM
Unknown Object (File)
Fri, Nov 8, 6:23 AM
Subscribers

Details

Summary

This prevents re-renders of SwipeableThreads. As of this diff we've reduced the time of ChatThreadList re-renders from ~600ms to ~70ms.

ChatThreadListItem before D9102:

014d54.png (1×2 px, 648 KB)

ChatThreadListItem before this diff:

8cb34d.png (1×2 px, 892 KB)

ChatThreadListItem after this diff:

3a946b.png (1×2 px, 920 KB)

(This is the chatThreadListItem for Daily Updates)


Depends on D9102

Test Plan

Things continue to look/work as expected.

Diff Detail

Repository
rCOMM Comm
Branch
arcpatch-D9103 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul published this revision for review.Sep 7 2023, 11:24 AM
atul edited the summary of this revision. (Show Details)
atul edited the summary of this revision. (Show Details)
atul added inline comments.
native/chat/chat-thread-list-item.react.js
133–140 ↗(On Diff #30852)

Might've gone too "high resolution" w/ the memoization, but personally find this more readable than the heavily nested JSX

While introducing a lot of memoization, we should also check how it affects memory usage

This revision is now accepted and ready to land.Sep 8 2023, 2:34 AM
In D9103#268200, @tomek wrote:

While introducing a lot of memoization, we should also check how it affects memory usage

Good point. When I previously used Xcode Instruments our app had pretty low memory usage, so will make sure that's still the case.

This revision was landed with ongoing or failed builds.Sep 8 2023, 3:11 PM
This revision was automatically updated to reflect the committed changes.