+
Skip to content

Conversation

iequidoo
Copy link
Collaborator

This is separated from closed #7180 . Everything related to fixing #7308 is removed. "Messages are end-to-end encrypted." is reordered in test_outgoing_encrypted_msg(), but as there are corner cases anyway (see #7308 ), this isn't important and shouldn't block code simplifications. The current code is hard to maintain and slow, i.e. it looks at every message in the chat, this doesn't scale.

Tested on some random chat, the SQL query took 1.411202ms (vs 6.692714ms before) in median. Still looks a bit slow, but already better.

Even if we decide that we don't want to add one more index to the db, the first commit has value on its own. There's no issue reference because there's no new work, i just moved the useful part of the closed PR here.

@iequidoo iequidoo changed the base branch from main to link2xt/ykltkokxntvk October 15, 2025 05:46
@link2xt link2xt force-pushed the link2xt/ykltkokxntvk branch from 5051240 to f1121da Compare October 15, 2025 17:16
@link2xt link2xt force-pushed the iequidoo/unbend-calc_sort_timestamp branch from adff64f to 9b1782b Compare October 15, 2025 17:16
@link2xt link2xt force-pushed the link2xt/ykltkokxntvk branch from f1121da to f6c2ada Compare October 16, 2025 02:59
@link2xt link2xt force-pushed the iequidoo/unbend-calc_sort_timestamp branch from 9b1782b to ba25096 Compare October 16, 2025 02:59
@link2xt link2xt force-pushed the link2xt/ykltkokxntvk branch from f6c2ada to a70866e Compare October 16, 2025 23:00
…mp_sent

This makes `calc_sort_timestamp()` a continuous function of the message timestamp, simplifies the
SQL query and prepares for creation of a db index for it so that it's fast. Currently it doesn't
uses indexes effectively; if a chat has many messages, it's slow, i.e. O(n).
Tested on some random chat, the SQL query took 1.411202ms (vs 6.692714ms before) in median. Still
looks a bit slow, but already better.
@link2xt link2xt force-pushed the link2xt/ykltkokxntvk branch from a70866e to e60632e Compare October 16, 2025 23:06
@link2xt link2xt force-pushed the iequidoo/unbend-calc_sort_timestamp branch from ba25096 to 4443d59 Compare October 16, 2025 23:06
@link2xt link2xt force-pushed the link2xt/ykltkokxntvk branch from e60632e to 9abbe7a Compare October 16, 2025 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载