Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.58k stars 2.92k forks source link

[Performance] Opening search for the first time on a big account is causing the app to hang massively #46590

Open hannojg opened 4 months ago

hannojg commented 4 months ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


What performance issue do we need to solve?

In a customers meeting the customer was trying to open the search for the first time in NewDot. It caused the app to hang up, and it was a very bad user experience (see the recording):

https://github.com/user-attachments/assets/99d97430-9545-475a-afca-7d0c5b5d1437

What is the impact of this on end-users?

User perception of the app is very bad, as it's super laggy, basically not usable (the browser even warns that the app is hanging).

List any benchmarks that show the severity of the issue

The customer shared a profile trace with us:

Firefox 2024-07-25 10.42 profile.json.gz

(note: the trace also contains other test cases as well)

The customer had ~15k reports loaded in onyx when these tests were conducted, although in focus mode only 6 chats were displayed.

Proposed solution (if any)

None yet, I will go through the profile and see what can be optimised, what exactly caused those lags.

List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)

not available yet

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: v9.0.11-5 Reproducible in staging?: not tested Reproducible in production?: yes Email or phone of affected tester (no customers): customer Logs: See performance file Notes/Photos/Videos: See attached video Expensify/Expensify Issue URL: n/a Issue reported by: @hannojg Slack conversation: https://expensify.slack.com/archives/C05LX9D6E07/p1721919928992729

View all open jobs on Upwork

melvin-bot[bot] commented 4 months ago

Auto-assigning issues to engineers is no longer supported. If you think this issue should receive engineering attention, please raise it in #whatsnext.

hannojg commented 4 months ago

cc @sakluger (feel free to assign me as I (or someone from my team) will work on this ticket!)

marcaaron commented 3 months ago

Curious what is happening with this especially to see if it is related to large numbers of reports (seems likely as there are 15k reports). Gonna assign myself in case @hannojg needs any assistance.

sakluger commented 3 months ago

No updates

sakluger commented 3 months ago

No update

hannojg commented 3 months ago

A large part of this hanging is due to us building the search options the moment we open the search page:

I am thinking about how to solve this here, by moving the operations in a first step to a separate thread/web worker:

hannojg commented 3 months ago

I just opened a PR hat shows a PoC for using web workers for running the search, which will unblock the main thread:

I am now seeking approval on this new technical design here.

(Note: I am OOO for the rest of the week and will continue next week Monday 19.08)

sakluger commented 3 months ago

Moving to weekly for now since Hanno is out until Monday.

hannojg commented 3 months ago

Can you please also assign @chrispader? he will work on that as well (Chris please comment 🫶 )

chrispader commented 3 months ago

Commenting for assignment :)

sakluger commented 3 months ago

Thanks for helping, @chrispader. I'll be OOO for the next week. Hopefully we'll have some more details from the investigation when I return!

hannojg commented 3 months ago

We were able to reproduce the bigger lags when running on a virtual machine, where the hardware is more constraint than on our recent MacBook Pro models directly. (note: we tested against a recent adhoc build that contained some search improvements).

The thing that takes the most time when opening the search page / chat finder page is:

Screenshot 2024-08-22 at 16 56 57

Screenshot 2024-08-22 at 16 57 03

Screenshot 2024-08-22 at 16 58 09

Screenshot 2024-08-22 at 16 58 15

We will come up with solutions for improving the performance of these functions (in the current single threaded architecture). (Some of these solutions might blend with the solutions we are working on here)

sakluger commented 3 months ago

@hannojg any updates on this investigation?

sakluger commented 2 months ago

No updates - seems like we are focusing on improving search speed first. There is a WIP PR for that (https://github.com/Expensify/App/pull/48652), hopefully we'll get back to this one after that.

sakluger commented 2 months ago

No updates.

marcaaron commented 2 months ago

What's the latest on this one?

hannojg commented 1 month ago

We were able to get another, cleaner, sample of that problem here which relates to creating the options (which causes the lag):

I am sure now that we have a cleaner recording we can come up with good solutions to make this faster!

sakluger commented 1 month ago

No updates.

sakluger commented 1 month ago

No updates.

sakluger commented 4 weeks ago

No updates

sakluger commented 2 weeks ago

No updates

sakluger commented 1 week ago

No updates