HomePhabricator
Diffusion Comm e630ac26992e

[native] Add some memoization to `Timestamp` component

Description

[native] Add some memoization to Timestamp component

Summary:
Looking at the Flamegraph in the React Developer tools I was surprised to see that A. rendering Timestamp took a good amount of time and B. re-renders were expensive.

The memoization here ensured that Timestamp only renders once when we navigate to the MessageList.

This isn't a huge deal compared to some of the other components that can be optimized, but it was a super quick improvement (~3ms per message... which when multipled by eg 8 messages is ~24ms which is a bit more than a frame)

Test Plan:
In the below flamegraph screenshot you can see how the Timestamp component ("Times..." in yellow) is a pretty large relative to the rest of ComposedMessage

dc96a9.png (2×3 px, 961 KB)

Reviewers: ginsu, rohan, tomek

Reviewed By: ginsu, rohan

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D9050

Details

Provenance
atulAuthored on Sep 1 2023, 2:10 PM
Reviewer
ginsu
Differential Revision
D9050: [native] Add some memoization to `Timestamp` component
Parents
rCOMM02c05d9f0771: [native] Refactor the deep links context provider to support both invite links…
Branches
Unknown
Tags
Unknown