Skip to content

perf: remove contacts from FullChat #6945

@WofWca

Description

@WofWca
  • Operating System (Linux/Mac/Windows/iOS/Android): All
  • Core Version: 1.160.0
  • Client Version: 1.59.2

Expected behavior

get_full_chat_by_id is fast-ish

Actual behavior

get_full_chat_by_id takes ~1 second to complete for a chat with 1000 members.

With DC desktop 1.59.2 the effect is that opening such a chat and loading its messages takes 1 second. May be even more on slower machines, or HDDs.

Steps to reproduce the problem

  1. Call get_full_chat_by_id

Although I haven't measured this exactly, but I imagine this part is pretty slow:

let mut contacts = Vec::with_capacity(contact_ids.len());
for contact_id in &contact_ids {
contacts.push(
ContactObject::try_from_dc_contact(
context,
Contact::get_by_id(context, *contact_id)
.await
.context("failed to load contact")?,
)
.await?,
)
}

IMO providing contact_ids is enough, and loading the individual contacts can usually be performed separately.

I would have made an MR, but I wanted to discuss the fact that it's a breaking change. The most conservative course of action would be to introduce a new RPC method called e.g. get_full_chat_by_id_2 and a new type, e.g. FullChat2, and mark the old ones as deprecated, but I wanted to check in about whether this is too ugly of a name.
And even if we do introduce it, when would be the time to remove the deprecated functions and rename the new ones? Are we ever gonna have the courage to start using semver and release a major version?

But this is probably not that significant of an issue and e.g. solving deltachat/deltachat-desktop#5235 could mitigate the effects of it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions