Closed Bug 1593994 Opened 5 years ago Closed 2 years ago

Very slow text input

Categories

(Core :: Performance, defect, P3)

70 Branch
Unspecified
Linux
defect

Tracking

()

RESOLVED INACTIVE
Performance Impact ?

People

(Reporter: github, Unassigned, NeedInfo)

Details

(Keywords: perf:responsiveness)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

After Firefox has been running a while (usually at least 20 minutes) any text input on any web page becomes very slow, lagging multiple seconds behind actual typing action.

I started seeing this with FF 70.0, but also now with 70.0.1. It only happens with Linux.

This is on a Debian Buster/10 system, using fvwm2 as the window manager and Xorg. Two monitors on an nVidia GTX 1080 Ti, with each screen as its own X display. It being Debian buster this is with the 418.74 drivers. Kernel is Debian's 4.19-based one.

I'm also seeing very high CPU use by both FF processes (just the one at a time) and Xorg itself. I've tried with a fresh profile and Discord as the test case and this still happens. Doing a 'Refresh' on my main profile also hasn't helped.

Pasting into a text input is near instant.

Actual results:

Very slow echoing back of text input, in any text input area on any web page. Scrolling with the mousewheel does not function whilst the text input is playing catch up. Clicking to move the cursor also doesn't work during catch up. Only the currently active text input area repaints if I change to another virtual desktop and back.

Expected results:

Normal text input, with feedback almost instant.

Component: Untriaged → Performance
OS: Unspecified → Linux
Product: Firefox → Core

Could you install profiler from https://profiler.firefox.com/ and then share the profile (there is a Publish button on the top-right corner) once you've captured the slowness in the profile?
Or do you have some testcase showing the issue?
(I haven't seen any issue and I'm using Nightly for weeks without restarting)

Flags: needinfo?(github)
Whiteboard: [qf:investigate]
Priority: -- → P3

Well, that didn't take long (he says typing painfully slowly here as well): https://profiler.firefox.com/from-addon/calltree/?globalTrackOrder=0-1-2-3-4-5-6-7-8-9&hiddenGlobalTracks=1-2-3-4-5-7-8-9&localTrackOrderByPid=4147-1-0~4200-0~4369-0~4251-0~4343-0~4271-0~&thread=7&v=4

The test case is basically "type stuff in input boxes until it starts happening". The "20 minutes" above is misleading, I think it's more about how much text is typed in across all input boxes. Sometimes I'm just reading things and only occasionally typing so it takes longer to see the issue.

Flags: needinfo?(github)

Ah, it helps if I publish and cite that URL: https://perfht.ml/2CmlHnK

So does this happen with Discord only? There seems to be lots of network activity to Discord.com when typing is happening.
Main thread is mostly idle while typing, but data is sent to https://discordapp.com/api/v6/channels/393758245472174081/typing all the time.

(In reply to Olli Pettay [:smaug] from comment #4)

So does this happen with Discord only? There seems to be lots of network activity to Discord.com when typing is happening.
Main thread is mostly idle while typing, but data is sent to https://discordapp.com/api/v6/channels/393758245472174081/typing all the time.

No, in fact I first noticed it with WhatsApp. And as noted above, certainly once it's started, it also affects input on this very site. I'm lagging a second or two behind right now typing this.

I've just noticed that once this slow down begins it even affects typing in the URL bar of any tab, including a newly opened one. Whilst it might be some javascript on the likes of Discord that initially triggers it, it's then affecting the whole browser. I've also seen repainting of the browser take excruciating seconds.

I tried a test with a simple page containing only a textarea and typing lots into it but couldn't trigger the issue, so it's not purely about text input.

This definitely doesn't require me actively using Discord for the bug to trigger. I've not even focused that tab yet this morning, having instead used Telegram for some messaging, and it's here right now. The "instead" in that last sentence was only just showing when I finished typing the sentence.

I can also state that it wasn't whatever imwheel does behind the scenes being part of the problem, as I removed that from my configuration and the problem still occurs. I also don't have any input method helpers running.

I think I'm also seeing this on Firefox 85, under Linux with Xorg Intel Sandybridge graphics, on app.slack.com, discord.com, and even on twitter.com: rapidly typing into the chatrooms' text input box (or composing a tweet), you can feel a noticeable lag that does not happen (not nearly as noticeable, at least) when using Chromium/Chrome. With Slack, the lagginess looks like this (make sure to watch with sound turned on): https://youtube.com/watch?v=aaY4583c4BA

The lag is not present in the native form widgets like this comment I'm writing here in bugzilla. Could it have something to do with the fact that all those fancy web apps use styled/non-native text entry widgets?

Jeff, can you collect a profile by using https://profiler.firefox.com/?

Flags: needinfo?(nekohayo)

Here is the profiling output from typing very fast on:

For the record: I already have webrender (all) force-enabled and the on-disk cache disabled to improve performance, but other than that my Firefox is pretty vanilla and I try to stick to (or reset to) defaults. The CPU on this ThinkPad X220 I'm typing on is an Intel Sandybridge Core i5 (2520M), 2.50GHz × 4.

Flags: needinfo?(nekohayo)

Here are some more strange observations. Right after I made those perf profiles above, I shut down Firefox, rebooted my whole machine (which had a 16 days uptime...), and upon launching fresh again (but still the same Firefox version, same settings, etc.), typing does not lag on those sites anymore... which kinda matches a bit what the original reporter was saying:

After Firefox has been running a while (usually at least 20 minutes) any text input on any web page becomes very slow, lagging multiple seconds behind actual typing action.

Now, you might think "OK so then something in your OS was borked up!", but then why would Chromium be unaffected? While Firefox was slow as molasses with this, Chromium/Chrome, running on the same instance/uptime, was keeping up with the fast typing without problems... so it still seems there is a performance problem in Firefox if "comparing with Chromium" is any indication, just that the conditions to trigger it in a visible manner are not always obvious. I hope that the perf profiles above help finding out the problem.

"Lagging while typing" is usually the first symptom people notice if a particular web content process is misbehaving. Some kind of issues, like memory leaks, can accumulate over time until they start causing noticeable problems.

Jeff, Athanasius,
Do you still experience this problem when using a newer version?

Flags: needinfo?(nekohayo)
Flags: needinfo?(github)

(In reply to Wayne Mery (:wsmwk) from comment #13)

Jeff, Athanasius,
Do you still experience this problem when using a newer version?

I can't recall the last time I experienced this. I should note, however, that I've not been using Linux much in the past 6 months. My hardware and setup otherwise remains the same.

So likely this got incidentally fixed at some point.

Flags: needinfo?(github)

It seems to still happen with the latest versions yes. If you just freshly log into such a chatroom you may not encounter the bug, but if you go into, for example, a Slack chatroom with lots of history, and scroll back up the history a fair bit (in a not-very-busy channel I scrolled all the way back to 2020, for example) and then try typing fast long strings of gibberish* text, you will experience periodic small freezes during typing, so I can only imagine that this would get worse in a real world usage scenario (as you switch between multiple channels that have activity throughout the day).

*: like

aoesnuth aoeu nstaohe usntahoesn uthaoesn tuhaosnet huasnoet huaosnet huasnoet huasnoetu hasonet uhaosnet uhaonset huaosnetuhaosnetu haosneuhtaosnetu haosnet huaosnetu hasonet uhasonetu haonsteh usanoteh usnaoteh snaoteh usnaothe usnatohe usntaoheu sntaohe sunthoes ntuhaosen tuhaoset huasoet uhasonetu hasonetuh oesnuthaoes ntuhaoes nutahosunthaoesn uthaosen uhtaosen uthaoesn uthaosen tuhaosnet uhasonth usnaoteh uasontehu sonatu hsaontehu saoet husaoteh usaothesnuth osathe usaoeu uaoe uaoe uoaeu oae uoeuaoeuaoeu

...or whatever your keyboard gives you when you piano-mash the keys as fast as possible

Flags: needinfo?(nekohayo)
Performance Impact: --- → ?
Whiteboard: [qf:investigate]

Jeff, could you create a fresh profile exhibiting this issue?

Flags: needinfo?(nekohayo)

With no answer from the reporter, we don’t have enough data to reproduce and/or fix this issue. Please reopen or file a new bug with more information if you see it again.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.