37690.patch fixes it here. It brings back cloning of the textarea but uses an actual off-screen textarea element instead of a div, this is fasted and safer. To additionally speed it up that clone is used only when deleting more than one character.

37690.patch fixes it here. It brings back cloning of the textarea but uses an actual off-screen textarea element instead of a div, this is fasted and safer. To additionally speed it up that clone is used only when deleting more than one character.

Some more testing will be appreciated :)

I can reproduce this behavior on Firefox 48.0 on Ubuntu 16.04.
The patch fix the problem for me.

I tested with a larger posts too. Unfortunately it is still very slow with posts that have more than 5,000 words. At that point the textarea is starting to get slower anyways, but holding down Backspace makes the browser "freeze" for few seconds.

In 37690.1.patch attempting to speed this up by using Underscore's throttle(). Seems to make it quite faster but has a small trade-off: when deleting empty rows by holding down Backspace, it doesn't reduce the textarea height fast enough. Then it "catches up" at the end.

Alternatively we can turn off the shrinking of the textarea, only resize when switching Visual => Text editor. It looks a bit odd when you delete most of the post, but that is quite rare.

I think delaying reducing the size isn't that bad, especially if we'd consider not doing it at all. Also, I think debounce would work better here than throttle? It will now attempt to reduce the size every half second you're deleting text, and we probably only want to reduce when you're done deleting text, especially if you're continuously hitting backspace on the same line.

In 37690.2.patch: do not use cloned element, "lock" the scrolling while resetting the textarea height instead. This seems fastest and most compatible.

Using debounce() instead of throttle() makes it worse when the user presses backspace or delete only once. We need to run shrinkTextarea() at the beginning and at the end of the delay, debounce() can do either beginning or end but not both.