Page MenuHomePhabricator

[native] Add some memoization to `UnreadDot`
ClosedPublic

Authored by atul on Sep 1 2023, 3:15 PM.
Tags
None
Referenced Files
F3389123: D9070.diff
Fri, Nov 29, 5:38 PM
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)
Oct 28 2024, 10:32 AM
Unknown Object (File)
Oct 25 2024, 12:41 PM
Subscribers

Details

Summary

Based on profiling, rendering UnreadDot takes ~0.8ms. That alone is pretty insignificant but multipled by 5 re-renders (in the "navigate to thread w/ varun scenario) and 29 instances of UnreadDot that adds up to ~116ms. Still not a lot, but pretty low effort to add memoization.

Test Plan

Continues to look as expected. Will do before/after profiling screenshot at end of the stack (Setting up profiler and doing multiple runs can be kind of slow/require restarting metro/etc/etc.) showing before/after.

UnreadDot not re-rendering when ChatThreadList re-renders:

911478.png (502×390 px, 26 KB)

Diff Detail

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

Event Timeline

atul requested review of this revision.Sep 1 2023, 3:34 PM
tomek added inline comments.
native/components/unread-dot.react.js
26–28 ↗(On Diff #30710)

You can consider using a shorthand

This revision is now accepted and ready to land.Sep 4 2023, 5:39 AM
native/components/unread-dot.react.js
26–28 ↗(On Diff #30710)

will update

This revision was landed with ongoing or failed builds.Sep 6 2023, 1:30 PM
This revision was automatically updated to reflect the committed changes.