Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize unreads model on mark-as-read #332

Open
gnprice opened this issue Oct 23, 2023 · 0 comments
Open

Optimize unreads model on mark-as-read #332

gnprice opened this issue Oct 23, 2023 · 0 comments
Labels
a-model Implementing our data model (PerAccountStore, etc.) performance Smooth and responsive UI; fixing jank, stutters, and lag
Milestone

Comments

@gnprice
Copy link
Member

gnprice commented Oct 23, 2023

In #304 we implemented the Unreads model, and measured that its performance was quite fast for most operations, but not for marking messages as read. The timings are in the series of messages starting at #304 (comment) .

In particular, in those experiments it took 0ms (to the nearest ms) to construct the whole model in the first place, as well as most other operations. But it took about 14ms for a mark-as-read event, whether for marking one or many individual messages as read.

As I said at #304 (comment) :

Given how very fast the constructor is in particular, I feel like it should be possible to get mark-as-read to be much faster — in particular I think it fundamentally shouldn't be any slower than the constructor. And taking 14ms is enough that it'll often cause a dropped frame, so that's worth avoiding.

The first step here is probably to profile to see specifically where the time is being spent, e.g. to get a flame chart:
https://docs.flutter.dev/tools/devtools/cpu-profiler#flame-chart

(My original suggestion at #304 (comment) didn't seem to help, or not much. That was without the benefit of profiling.)

Given that the existing code is already much faster at constructing the whole model from scratch than it is at handling mark-as-read, I'm expecting that there'll turn out to be a way to make this much faster without needing the deeper data-structure changes described at zulip/zulip-mobile#4684 . If we do need the latter (or do eventually pursue those too, for the sake of going even faster), then that will be a post-launch task.

@gnprice gnprice added the a-model Implementing our data model (PerAccountStore, etc.) label Oct 23, 2023
@gnprice gnprice added this to the Beta milestone Oct 23, 2023
@gnprice gnprice modified the milestones: Beta 1, Beta 2 Nov 8, 2023
@gnprice gnprice added the performance Smooth and responsive UI; fixing jank, stutters, and lag label Nov 18, 2023
@gnprice gnprice modified the milestones: Beta 2, Beta 3 Nov 22, 2023
@gnprice gnprice modified the milestones: B2: Summer 2024, Launch May 9, 2024
@gnprice gnprice modified the milestones: Launch, Post-launch Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-model Implementing our data model (PerAccountStore, etc.) performance Smooth and responsive UI; fixing jank, stutters, and lag
Projects
Status: No status
Development

No branches or pull requests

1 participant