Page MenuHomePhabricator

[lib] Fix useThreadSearchIndex performance issue
ClosedPublic

Authored by ashoat on Jun 19 2023, 12:31 PM.
Tags
None
Referenced Files
F3263350: D8248.id27864.diff
Sat, Nov 16, 12:05 AM
Unknown Object (File)
Fri, Nov 1, 10:10 AM
Unknown Object (File)
Fri, Nov 1, 10:10 AM
Unknown Object (File)
Fri, Nov 1, 10:08 AM
Unknown Object (File)
Fri, Nov 1, 9:52 AM
Unknown Object (File)
Fri, Nov 1, 6:51 AM
Unknown Object (File)
Fri, Oct 18, 9:02 PM
Unknown Object (File)
Oct 2 2024, 1:06 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable