Page MenuHomePhabricator

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

Authored by atul on Sep 7 2023, 11:22 AM.
Tags
None
Referenced Files
F3181503: D9103.id30883.diff
Fri, Nov 8, 6:23 AM
Unknown Object (File)
Tue, Oct 22, 2:18 PM
Unknown Object (File)
Tue, Oct 22, 2:18 PM
Unknown Object (File)
Tue, Oct 22, 2:18 PM
Unknown Object (File)
Tue, Oct 22, 2:17 PM
Unknown Object (File)
Tue, Oct 22, 5:04 AM
Unknown Object (File)
Sep 19 2024, 10:06 AM
Unknown Object (File)
Sep 18 2024, 5:56 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.