keepthatworktoyourself / wombat

Not another website builder. Public repo — raise issues, request features, get help.
2 stars 0 forks source link

Editor slows down gradually as you type, and leaks large amounts of memory #244

Closed bhallstein closed 1 year ago

bhallstein commented 1 year ago

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.

pjrundle commented 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.

https://dev.to/unadlib/mutative-10x-faster-than-immer-2060

bhallstein commented 1 year ago

Progress:

With this, my current best guess is that react-query is our main issue here, but more investigation needed.

bhallstein commented 1 year ago

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.