Keyboard input - lagging/delay/slow performance

Hi all, in our Script Editor (based on PM) when we start typing on an empty document - the keyboard typing works immediately and draws the keys pressed instantly.

Once we load more content though (i.e. 75 pages of content) - each key press starts to lag and causes a delay, before the letter appears on DOM. So when the user starts typing fast - half of the keys pressed do not appear.

What causes this lagging/delay of the keyboard input? Is there a way, we can avoid/optimize it?

Greetz, Pavel

Have you profiled?

Hi Marijn,

no we haven’t. Which tool/browser would you best suggest for that purpose?

Greetz, Pavel

Chrome has a good profiler in its devtools.

Hi Marijn, Thank you very much for your help!! We profiled, tested, stopped and started different plugins and found out that the reason for the lagging is that we need an optimization on our plugins decorations in order to improve performance, based on documentation https://prosemirror.net/docs/guide/ in section Decorations. (Mapping) However in one of our plugins we do not use decorations, should we still do the same optimization for it in order not to decrease the overall performance of the plugins pipeline? (see screenshot of the code and the question is : do we need the green part of the code, in case the plugin does not use decorations)

(as a result the lagging disappeared!!)

Greetz, Pavel

No, definitely not (plugin state is computed separately per plugin, you don’t need to add code that does nothing to plugin A to speed up plugin B).

Hi @marijn thank you very much. We remove the state of that particular plugin and it still worked very nice!

Greetz, Pavel