Very slow typing in Element chat (randomly)
Categories
(Core :: Layout, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox87 | --- | affected |
People
(Reporter: yoasif, Unassigned)
References
Details
Attachments
(1 file)
|
36.84 KB,
text/plain
|
Details |
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.
| Reporter | ||
Comment 1•5 years ago
|
||
Comment 2•5 years ago
|
||
The slow key events correlate well with some javascript. Looks like they were slow because of an event listener on keypress event.
Comment 3•5 years ago
|
||
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.
Comment 4•5 years ago
|
||
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.
Comment 5•5 years ago
|
||
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.
Comment 6•5 years ago
|
||
Changed component because I suspect this has to do with layout.
Comment 7•5 years ago
|
||
(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.
Comment 8•5 years ago
|
||
Nothing here hints an issue in DOM Events implementation.
But reflows certainly are slow.
Is this some flexbox issue, at least partially.
Comment 9•5 years ago
|
||
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.
Updated•5 years ago
|
Comment 10•5 years ago
|
||
This may be similar to bug 1699501, which also shows very long reflow with nested flexbox usage (also in a chat client, fwiw).
Comment 11•4 years ago
|
||
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.
Updated•2 years ago
|
Description
•