Page MenuHomePhabricator

[lib] Fix useThreadSearchIndex performance issue
ClosedPublic

Authored by ashoat on Jun 19 2023, 12:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 10, 8:06 AM
Unknown Object (File)
Sat, Sep 7, 1:50 AM
Unknown Object (File)
Thu, Aug 29, 2:36 AM
Unknown Object (File)
Thu, Aug 29, 2:36 AM
Unknown Object (File)
Aug 24 2024, 3:39 PM
Unknown Object (File)
Aug 19 2024, 2:32 PM
Unknown Object (File)
Aug 18 2024, 9:26 PM
Unknown Object (File)
Aug 17 2024, 9:03 PM
Subscribers

Details

Summary

To enable search of chats by chat name and member name, we have in-memory JS search index. This search index needs to get updated when underlying Redux data changes, and it needs to ENS-resolve both member names and chat names.

I have 93 threads with ENS users. This resulted in a huge performance issue on my iOS device, since the thread search index was getting recalculated as each ENS name streamed in, one-by-one.

This diff makes it so we wait until all of the ENS fetches either resolve or time out before recalculcating the thread search index. This guaranteees that there will be at most 2 ThreadSearchIndex recalculations per update of the underlying Redux data (threadStore, userStore, and currentUserInfo).

Test Plan

I compiled a release build to my physical device and confirmed that the JS thread was no longer stalled after the splash screen dismissed

Diff Detail

Repository
rCOMM Comm
Branch
ashoat/threadsearchindex
Lint
No Lint Coverage
Unit
No Test Coverage