Page MenuHomePhabricator

[native] Add some memoization to `UnreadDot`
ClosedPublic

Authored by atul on Sep 1 2023, 3:15 PM.
Tags
None
Referenced Files
F3049651: D9070.id30811.diff
Wed, Oct 23, 5:24 AM
F3049631: D9070.id30710.diff
Wed, Oct 23, 5:17 AM
F3049282: D9070.diff
Wed, Oct 23, 3:21 AM
F3043146: D9070.id30811.diff
Tue, Oct 22, 2:17 PM
F3043145: D9070.id30810.diff
Tue, Oct 22, 2:17 PM
F3043144: D9070.id30710.diff
Tue, Oct 22, 2:17 PM
F3043127: D9070.id.diff
Tue, Oct 22, 2:17 PM
Unknown Object (File)
Tue, Oct 22, 5:04 AM
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
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

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

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.