Rocket.chat: Typing a message becomes slower the more lines the message contains

Created on 25 Apr 2018  路  12Comments  路  Source: RocketChat/Rocket.Chat

Description:

When I type a message that spans several lines, Rocket.Chat becomes very sluggish.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.63.2
  • Operating System: Debian stretch
  • Deployment Method(snap/docker/tar/etc): tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Disabled
  • Node Version: v8.9.3
  • mongoDB Version: mongodb-org 3.2.17

Steps to Reproduce:

  1. Type several lines into the message box (separate the lines with Shift+Enter). The lines don't have to be long - ten lines with a single character will trigger the issue just fine:

    a
    a
    a
    a
    a
    a
    a
    a
    a
    

    More lines seem to increase the sluggishness.

  2. Now try to type a complete sentence, e.g. The quick brown fox jumps over the lazy dog. Notice how sluggish the typing has become.

I can reproduce this issue both in the Electron client on Ubuntu, and on the website.

Expected behavior:

Typing shouldn't slow down just because of a few lines.

Actual behavior:

Typing slows down noticeably.

uux bug

Most helpful comment

@theorenck if you have any chance to triage this for 0.65.0 instead of 0.66.0 it would be awesome. I know, time for merging is almost up... but this issue has gotten worse on 0.64.0 (for me, probably for others, too).

Cheers
Thomas

All 12 comments

Mhhhh... I can kinda sorta reproduce this, though while it is noticeable, it doesn't seem to impact me as bad as you (I tried with more than 20 times of your suggested amount of lines). This might be subject to the user's machine (and it's speccs) though. It does get worse though, the more lines there are.

Cheers
Thomas

It's unbelievably annoying when pasting code samples into Rocket.Chat. I tend to write some text, then paste a multi-line code sample into a ``` block, write some more text, paste another code sample, and so on, and only then I submit the complete message. After the second code sample, the latency becomes so bad that I have to CTRL+A CTRL+X CTRL+V my message into a text editor so I can edit it properly :(

Yes, this is infuriating, it's been a problem for a while and is pushing us back to email for lengthy conversations. Hoping this can be fixed ASAP. Using a Surface Pro 2 with i5 and 8GB of RAM as my primary communication box.

@rocket-cat label add "type: bug"

@theorenck once this gets tackled, maybe also have a look at #10690 - it might be the same reason?

Cheers
Thomas

My problem #10690 is indeed related, this makes chat almost unusable on high dpi screens, even for very short messages.
I narrowed it down to height calculation issue (when typing, textarea height is constantly updated between 21.9978px and 22px, which causes lag)

the following custom styles fixed the problem for me (at the cost of disabling autogrow, which is ok for me)

.emoji-picker-icon {
    width: 28px !important;
    display: block;
}
.rc-old textarea {
  height: 22px !important
}

Proper solution would be to calculate height in setTimeout() not on keypress, and debounce it, plus fix height calculation.

Maybe switch to another autogrow? This one doesn't have this issue https://github.com/ro31337/jquery.ns-autogrow/blob/master/dist/jquery.ns-autogrow.js

@theorenck if you have any chance to triage this for 0.65.0 instead of 0.66.0 it would be awesome. I know, time for merging is almost up... but this issue has gotten worse on 0.64.0 (for me, probably for others, too).

Cheers
Thomas

I have a high DPI screen and have a similar issue: #10900

Right now, it's almost unusable for me :(

I have the very same issues on an Thinkpad x250.
Typing on both the internal FHD display (no external monitors connected etc..) as well as with an external 4K monitor is laggy. Both electron (thus chromes engine) as well as Firefox behave this way. Firefox feels a bit smoother but I can't really give exact figures.

Text sometimes appears in groups after noticeable delay while other characters seem to appear one after another with a tolerable delay. If the experience would be consistent the problem would probably not that bad.

My best guess is (as stated above) that there are just a few too many javascript operations going on per keystroke. If you type while looking at your keyboard or very slowly that might not be an issue at all...

I've recorded the typing and you can see the longer the "lines" are the less smooth the applcation performs (while typing at least):

2018-07-30-170822_1599x522_scrot

hey I made this pr to test, could you try if this code improve something?
https://github.com/RocketChat/Rocket.Chat/pull/11686

I am still having this problem. The type window gets very laggy when I type, especially longer messages with use "multi-line".

Issue still persists on version 2.15. Basically unusable for chatting at this point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dennis-f picture dennis-f  路  62Comments

HammyHavoc picture HammyHavoc  路  52Comments

engelgabriel picture engelgabriel  路  158Comments

gwillen picture gwillen  路  77Comments

pnewell picture pnewell  路  243Comments