Closed bhallstein closed 1 year ago
Have seen this too.
Wonder if Immer is a problem here, found this package which could be a simple swap out from a quick read.
Progress:
CWebTxt
is a performance bottleneck due to its call to getThemeCssPropsAndBodyClasses
, in a typical page render this was taking up 34ms of CPU time (if I understand what I'm looking at correctly). Can prob by easily fixed by putting the props and vars in a context.react-query
, and this seemed quite concerning, with individual calls to useWhateverQuery
taking ~1-2 ms, which is about a thousand times slower than I would have assumed, and they're used liberally.With this, my current best guess is that react-query is our main issue here, but more investigation needed.
Update: more testing showed the above performance figures as taken in a Timeline recording to be inflated by around 10x.
I found what I believe was the main memory leak and performance issue, details in linked PR.
When you initially type into the editor, it is pretty responsive. The more edits you make (the more key presses accumulate inside plain and rich text editors), the slower it becomes. This is not affected by the amount of text present, but the number of key presses that have occurred in the editor since page load.
As you type, the memory footprint of the page also grows. After doing a medium amount of typing, the page has grown from a starting point of ~150MB to ~1GB. At this point visual updates from typing are very slow and CPU usage is very high.
Thinking about where this might be at a high level:
Probably also worth looking into tools that can help identify where memory leaks are occurring.
Quite a serious bug as makes the app borderline unusable after typing any significant amount of text.