ether / ep_spellcheck

Toggle native spell checking in Etherpad
Apache License 2.0
6 stars 9 forks source link

Poor typing performance with spell checking enabled #26

Open ingoncalves opened 2 years ago

ingoncalves commented 2 years ago

From https://github.com/ether/etherpad-lite/issues/5302

Users reported poor performance while typing. This problem was observed in both small and large documents, especially when there are multiple users editing the same document (also observed with a single user).

In fact, the performance is severely degraded, without visual response (0 FPS) while typing, with the text being rendered after dozen seconds after stopping typing. Initially, it was observed only in Google Chrome version 96 or later. Tests were performed on Mackbook Pro (16-inch 2019, 16GB RAM, SSD, 2.6 GHz 6-Core Intel Core i7) and also on Linux and Windows. Besides that, curiously the problem was even worse after switching tabs in the browser.

After a deep investigation in our code (core + plugins) in order to find the root cause, we figured out the problem stops when the browser's spellcheck is disabled. By enabling the spellcheck in Firefox, it also showed the same performance issue.

We also noticed that, in our stack, the ep_spellcheck plugin is responsible for enabling the spellcheck in the Etherpad’s #innerdoc iframe. By disabling this plugin, the performance gets back to normal.

To Reproduce

The minimum setup to reproduce this problem is to use Etherpad with ep_spellcheck plugin only.

Steps to reproduce the behavior:

  1. Creates a pad
  2. Access the created pad with two users and start typing (also possible with a single user)
  3. If necessary, switch to another browser tab and go back to the pad
  4. See very slow typing speed

Expected behavior Typing speed should be fluid.

Server (please complete the following information):

Desktop (please complete the following information):

vitmf commented 2 years ago

With a large text, when the spell checker is turned on the socket gets stuck in a reconnect loop. I believe this behavior may be causing excessive processing and compromising performance while typing.

https://user-images.githubusercontent.com/640041/143929785-3b576338-ac8d-460a-9d1d-8f881c9141b6.mp4

https://user-images.githubusercontent.com/640041/143929788-a8a0135e-6ea0-4d39-a75a-1d75590a4864.mp4

.