alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
506 stars 45 forks source link

Redrawing room list buffer can be slow when in many rooms #298

Closed Rutherther closed 1 month ago

Rutherther commented 1 month ago

OS/platform

Guix System or NixOS

Emacs version and provenance

Tried from both Nix and Guix, both times with jit native compilation enabled. GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)

Emacs command

./with-emacs.sh --dir /tmp/test

Emacs frame type

GUI

Ement package version and provenance

I've used method in README to obtain from latest commit. That is 3f87a95 when trying this.

Actions taken

  1. execute ement-connect
  2. log in
  3. wait for a bit after the ement room list opens

Observed results

After few seconds Emacs lags, for a few seconds without being able to do anything. This repeats every few seconds between the lags.

Expected results

I should be able to use emacs normally when having ement room list open.

Backtrace

No response

Etc.

       51922  54% + timer-event-handler
       40607  42% + command-execute
        3010   3% + ...
         274   0% + redisplay_internal (C function)
           3   0%   mouse--click-1-maybe-follows-link

I have not used profiler at all till now and I am not sure how to get relevant information. I can run for specific functions, but I don't know what to target.

I observe this behavior both in my regular Emacs installation and on a fresh new emacs version obtained with with-emacs.sh script.

I am on Conduit server. I also have sliding sync running on the server. I am in more than 200 rooms. Few of the rooms are bigger groups. But most of them are bridged DM rooms. I use Mautrix Discord (no guild bridged, only DMs), Mautrix Telegram, Mautrix Whatsapp, Mautrix Meta, Heisenbridge (bridging a few irc groups).

I have tried registering a separate account and join a few rooms (I am in those on my main account) that have more members. I did not observe this behavior on that account.

I have already reached alphapapa through Ement.el room, where it was suggested to open an issue. This was like two weeks ago (sorry for taking so long)

alphapapa commented 1 month ago

@Icy-Thought No problem, thanks. From that report it seems that it must be not taking long at all. How many rooms are you in? And how long is it taking to revert the buffer?

Icy-Thought commented 1 month ago

Glad to provide the logs! :) I am part of < 30 rooms (28 if I counted right) and manually executing g r was very quick because it did not have to update many rooms.

alphapapa commented 1 month ago

Yeah, with that few rooms, updating the room buffer should be imperceptibly fast. Thanks.

AFAIK this is solved now (other than the idea to debounce the automatic reversion, which is tracked elsewhere), so closing now.

Icy-Thought commented 1 month ago

Thank you so much for taking the time to fix this issue! Have an awesome day! :tada:

alphapapa commented 1 month ago

@Icy-Thought Thanks for the kind words, and for your help in debugging it.

Icy-Thought commented 1 month ago

Anytime! Just ping and I'll try to help out where I can! :blush: