Closed Bug 1691863 Opened 5 years ago Closed 2 years ago

Very slow typing in Element chat (randomly)

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1699501
Tracking Status
firefox87 --- affected

People

(Reporter: yoasif, Unassigned)

References

Details

Attachments

(1 file)

Basic information

Steps to Reproduce:

I noticed today twice (between restarts) that typing in Element (https://chat.mozilla.org) was very slow, with high latency between typing a character and having it appear in the chat window.

Expected Results:

Slow typing.

Actual Results:

Fast display of type, as fast as I can type.


More information

Profile URL: https://share.firefox.dev/2MIj9sV

Basic systems configuration:

OS version: Ubuntu Hirsute Hippo (development branch)

GPU model: NVIDIA Corporation -- NVS 3100M

Number of cores: 2

Amount of memory (RAM): 8GB

Thanks so much for your help.

Attached file about:support

The slow key events correlate well with some javascript. Looks like they were slow because of an event listener on keypress event.

There is very few samples in this profile, so it looks like that machine was swamped. I'm moving this to WR, because it's strange that there's so many SwCompositor threads on a 2-core machine.

Component: Performance → Graphics: WebRender
Flags: needinfo?(nical.bugzilla)

There is one SwComposite thread per window which isn't great but generally when we have a lot of windows it is because of popups and the likes coming from the UI and addons, and they tend to be mostly idle/hidden, so while it's not great for memory usage it should be fine as far as CPU load goes.

Asif, in about:profiling, what is your sampling interval set to?

We're getting about one sample every 5ms; if the interval is set to the default of 1ms, that would indicate that the processor is loaded, as Bas says.

I gather pid 20682 is the Matrix session since it's the only process with interesting activity. There is some activity elsewhere in the browser, including some telemetry collection and a GC on the main thread, but nothing that would seem to be starving Matrix of the processor's attention.

There seems to be a reflow taking place after every keystroke. That seems bad.

Component: Graphics: WebRender → DOM: Events

Changed component because I suspect this has to do with layout.

(In reply to Jim Blandy :jimb from comment #5)

Asif, in about:profiling, what is your sampling interval set to?

In the profiler UI, if in the top right corner you click "Uploaded Profile" (I know the name doesn't make this discoverable), the profile metadata panel says "Interval: 1ms".

I gather pid 20682 is the Matrix session since it's the only process with interesting activity. There is some activity elsewhere in the browser, including some telemetry collection and a GC on the main thread, but nothing that would seem to be starving Matrix of the processor's attention.

The main thread of all processes, especially the idle ones, have lots of "Runnable - DummyEvent" markers. I don't understand the code at https://searchfox.org/mozilla-central/rev/362676fcadac37f9f585141a244a9a640948794a/widget/nsBaseAppShell.cpp#264-280 unfortunately.

There seems to be a reflow taking place after every keystroke. That seems bad.

I think it's because reflows take so long that after every one of them there are pending keyboard events.

Nothing here hints an issue in DOM Events implementation.
But reflows certainly are slow.
Is this some flexbox issue, at least partially.

Component: DOM: Events → Layout
Flags: needinfo?(dholbert)

Yeah, looks like there are slow ( >200ms) reflows here, with some nested flexbox in the backtrace. Here's the profile zoomed to the relevant thread where the slow reflows are:
https://share.firefox.dev/3r0CUe3

Here's a zoomed-in view of what looks like the longest reflow (612ms, based on the tooltip that shows up if I hover the colorful bar in the chart): https://share.firefox.dev/3ksHC1v

We had a similar issue with typing on WhatsApp Web in bug 1376536 [adding to see-also]; though this isn't exactly the same, since that one was fixed a while back.

See Also: → 1376536
Flags: needinfo?(nical.bugzilla)

This may be similar to bug 1699501, which also shows very long reflow with nested flexbox usage (also in a chat client, fwiw).

Severity: -- → S3
See Also: → 1699501

Asif, are you still seeing this problem when using a newer version??

(In reply to Jonathan Kew (:jfkthame) from comment #10)

This may be similar to bug 1699501, which also shows very long reflow with nested flexbox usage (also in a chat client, fwiw).

^ was closed just a few days ago.

Flags: needinfo?(yoasif)
Status: NEW → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1699501
Flags: needinfo?(yoasif)
Flags: needinfo?(dholbert)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: