1f604 / supersimplewiki

Placeholder project.
GNU General Public License v3.0
0 stars 0 forks source link

Issue 18: Poor performance on clientside editor for large text files (> 300kb) #33

Open 1f604 opened 2 years ago

1f604 commented 2 years ago

When editing large text files, the clientside browser-based text editor is laggy when rendering the preview of the page.

For small pages (50kb) clicking the Preview button loads it instantly. The delay gradually gets bigger the bigger the page is.

This is a purely clientside issue because the server converts Markdown to HTML very fast (less than 100ms for King James Bible which is 4.4mb, so it's more than fast enough for our purposes).

I sent the POST request using Postman, which said that response time was 191ms (subsequent requests took 120ms) which should not be noticeable. But on my browser it seems to take 4-5 seconds for the page to update for a 4mb page. I don't know why it took so long but the Performance tab showed 1-2 seconds spent in GC.

The editor is still usable, it's just a bit slow when editing large pages.

Solutions would be:

  1. Avoid large pages
  2. Fix the editor

I would prefer the latter but for now I think we'll just have to go with the former. So, split books into chapters etc.

1f604 commented 2 years ago

I should add that the server doesn't care about what client-side editor you use. So we can make a drop-in replacement for the clientside editor and we don't have to change anything on the server.

So this issue is fine to leave for now, we can make more editors later. Also a good issue for new starters.

1f604 commented 2 years ago

Request Timings for the clientside editor (4.4mb king james bible):

Sending: 33ms Waiting: 98ms (this seems about right) Receiving: 92ms

So in total the network traffic only takes 120ms. So most of the time is probably taken up by some slow javascript.

Might be worth adding that the w3 HTML TryIt preview editor took around 3 seconds to render the King James bible, while it takes like 5-6 seconds to render on the MarkItUp editor. So, probably there is some extra javascript in MarkItUp that slows it down.