element-hq / element-desktop

A glossy Matrix collaboration client for desktop.
https://element.io
GNU Affero General Public License v3.0
1.17k stars 267 forks source link

Extremely low fps (about 5-10 seconds per frame) on secondary monitor while running fine on primary monitor #675

Open justjanne opened 1 year ago

justjanne commented 1 year ago

Steps to reproduce

  1. Have 2 monitors (Dell UP2718Q 3840x2160 @ 60Hz and Siemens P17-2 @ 75Hz) in a layout where the Dell is at 150% scale in landscape and the Siemens at 100% scale in portrait. Use fractional scaling under X11 with Budgie for this.
  2. Move the window to the primary monitor. Everything is smooth and fluid.
  3. Move the window to the secondary monitor.

Outcome

What did you expect?

Element Desktop should be just as fluid as on the secondary monitor as other apps (e.g., Quassel) are, or as Element Web in Firefox is.

What happened instead?

Element was hanging, stuttering, even taking minutes to act on user input. Only electron apps like Element or Discord are affected, it does not affect Quassel or Telegram. It does not occur in element in Chromium or Firefox, only the desktop app.

Operating system

Ubuntu Budgie 22.04.2 LTS

Application version

Element version: 1.11.24 Olm version: 3.2.12

How did you install the app?

Element DEB repo

Homeserver

matrix.org

Will you send logs?

Yes

justjanne commented 1 year ago

I wrote a small script I ran in the devtools of element desktop to test this:

let run = true;
let lastFrame = null;
const f = () => {
  const currentFrame = Date.now();
  if (lastFrame) {
    console.log(currentFrame - lastFrame);
  }
  lastFrame = currentFrame;
  if (run) {
    window.requestAnimationFrame(f);
  }
};

window.requestAnimationFrame(f);

It reported this on the primary monitor:

[16, 17, 16, 17, 16, 18, 16, 17, 16, 17, 17, 16, 17, 17, 16, 17, 16, 17, 17, 17, 16, 17, 17, 16, 17, 17, 17, 16, 17, 16, 18, 15, 17, 17, 17, 16, 17, 17, 17]

And this on the secondary monitor:

[983, 1, 998, 1, 999, 1, 16, 984, 1, 16, 983, 1, 16, 983, 1, 17, 983, 1, 16, 983, 1, 17, 983, 1, 16, 983]
MadLittleMods commented 1 year ago

@justjanne Anything obviously taking up the time if you record a session in the devtools performance profiler? Can you share the profile file for others to examine?

justjanne commented 1 year ago

@justjanne Anything obviously taking up the time if you record a session in the devtools performance profiler? Can you share the profile file for others to examine?

I'll do so tomorrow, but I doubt that's the issue, as just moving it to the other screen makes it run well again.

I think something's wrong with electron, but I haven't yet figured out what specifically is broken.