Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow when having a large amount of signatures #121

Open
tangyaocn opened this issue Mar 7, 2020 · 7 comments
Open

Slow when having a large amount of signatures #121

tangyaocn opened this issue Mar 7, 2020 · 7 comments

Comments

@tangyaocn
Copy link

The program becomes very slow when there are many cells. Sometimes the program will take several minutes to respond after pressing the back bottom. I suspect the drop in performance is due to using url as a data storage (the url can become really long, 400k+ in my case). Also the url seems to be decoded and encoded for every operation, this might has direct effects on the performance.

@NickHu
Copy link
Collaborator

NickHu commented Jun 6, 2020

image
Yes, it is pretty clear to me that this is the major performance issue (see screenshot; it calculates the layout almost immediately, but then spends 7+ seconds serialising each time, which makes the program unusably slow).

@zrho is this something that is worth monkey-patching in the existing implementation or is it better to wait until the rewrite is done? I think it's time to retire the idea of putting data into the URL. The major implication of this is that we will actually have to implement undo properly.

@jamievicary
Copy link
Collaborator

jamievicary commented Jun 6, 2020 via email

@NickHu
Copy link
Collaborator

NickHu commented Jun 6, 2020

@jamievicary ad5f553 seems like it's using Pako, which is deflate (zlib) and not LZ4. Why was this changed?

Addendum: lz-string library is not an implementation of LZ4, but an older (probably slower) algorithm called LZW.

@zrho
Copy link
Collaborator

zrho commented Jun 6, 2020 via email

@NickHu
Copy link
Collaborator

NickHu commented Jun 6, 2020

@zrho The problem is that the way undo works is by deserialising the entire state of the application. Seems like the latency arises from compression, but perhaps this isn't the best way to implement undo/redo anyway. There's a higher-order reducer called redux-undo which might just be able to save us lots of work.

@jamievicary
Copy link
Collaborator

jamievicary commented Jun 9, 2020 via email

@NickHu
Copy link
Collaborator

NickHu commented Jun 10, 2020

There are two more options:

  • Store the application state for every change

This is basically (1) except you don't have to serialise/deserialise all the time, which is probably preferable.

  • Rather than having logical diffs like you suggest in (2), just store some appropriate form of JSON diff for the application state-over-time

I imagine in a modern web browser, the first probably does the second for you (probably redux-undo, which is based on the model of the first, is actually doing something like this).

The other thing is that tweaking the compression algorithm is conceptually simple, but it is a breaking change that we want to avoid doing too often (effectively, changing this changes our database schema). It's best to take the opportunity do to it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants