hacker-slides icon indicating copy to clipboard operation
hacker-slides copied to clipboard

hacker slides slow down

Open servusoft opened this issue 7 years ago • 11 comments

The behavior of big slides is slower. It is stored too often. If the saving takes a long time, you have to wait before you can continue typing.

I have made a small optimization: https://github.com/servusoft/hacker-slides/commit/83148616117d791d3346bca7bbc3547c5de6050f

It helps a bit, but in optimal case the time should change automatically, depending on the duration of the storage process.

servusoft avatar Feb 24 '18 11:02 servusoft

@servusoft interesting. It not very optimized for IO and even 1 byte change in the slide will result sending entire file content to the server and writing it to the filesystem.

The optimal way would be just sending the changed diff and writing this diff to file but initially it seemed as not easy to implement. Your change with the last cursor seems to be a good first step in optimization :)

I will pay locally with a large file to see if I can optimize anything else.

@servusoft Please make the pull request with 8314861 commit 👍

msoedov avatar Feb 24 '18 17:02 msoedov

While working with hacker slides, I noticed that it freezes from time to time and I have to wait a bit before I can continue typing. The investigations have shown that the data is permanently sent to the server, even with cursor movement.

It certainly depends on the speed of the connection. In the local connection, it does not matter. But the hosted on a remote server docker instance can hang something.

Sure, sending the differenial data would be quite optimal, but that's not easy to implement. A compromise would be to send only the current slide. The delay can also happen by page rendering.

To get a feeling, I temporarily created a page with docker: http://www.wolfonstage.de:1291/stash

servusoft avatar Feb 25 '18 00:02 servusoft

Happy Saturday @servusoft ! Have you tried #38 patch? It suppose to boost editing performance at-least for a bit. I got an another idea to just send the changed line and line offset to the server on any keystroke or/and periodically

msoedov avatar Feb 25 '18 00:02 msoedov

I just tagged and pushed msoedov/hacker-slides:1.0.0 image which includes some optimizations

msoedov avatar Feb 25 '18 01:02 msoedov

Now I have the same slide - README.md on 0.9 (without chaching) on http://www.wolfonstage.de:1291/stash/edit/README.md and on 1.0.0 (with chaching) http://www.wolfonstage.de:1292/stash/edit/README.md I think, it is not significantly better.

servusoft avatar Feb 25 '18 16:02 servusoft

Does 0.9 version include your changes servusoft/hacker-slides@8314861 ? It feels like 1.0.0 version doing even worse than 0.9 :)

msoedov avatar Feb 25 '18 16:02 msoedov

I have not sent the PR yet.. I wanted to look at the slide with cachinng. Now I have my own build (master) with my optimazation. http://www.wolfonstage.de:1293/stash/edit/README.md

servusoft avatar Feb 25 '18 17:02 servusoft

it does not look like it really helps. The cause may be due to the reendering.

servusoft avatar Feb 25 '18 17:02 servusoft

There are two different issues

  • Freezes during typing which is kind of solved by combination of yours patch and caching
  • Delays in re rendering - this is not really trivial to fix and will require some additional work

msoedov avatar Feb 25 '18 17:02 msoedov

Ok then let's go first. then I send the PR

servusoft avatar Feb 25 '18 18:02 servusoft

@servusoft good caught man! I will see what can optimize on front end side this week

msoedov avatar Feb 26 '18 16:02 msoedov