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

rebase performance #18

Open
carlsverre opened this issue Sep 11, 2023 · 0 comments
Open

rebase performance #18

carlsverre opened this issue Sep 11, 2023 · 0 comments
Assignees

Comments

@carlsverre
Copy link
Contributor

Currently we are rebasing the timeline every time we receive a frame from the server. This is needlessly expensive and can be improved.

Two perf holes:

  1. the server is sending us more frames soon
  2. we have a lot of pending mutations that haven't been seen by the server

2 can sometimes imply 1, however 1 can also happen if other clients are sending tons of changes.

To optimize for 1, the server can send a hint to the client with the number of outstanding frames. This allows the client to make better decisions about rebase.

To optimize for 2, we can try to optimize using the following facts

  • how many pending mutations have yet to be acknowledged by the server
  • how fast are other timelines changing (we can determine this by looking at the timelines table in the db)

We can come up with some heuristics regarding these facts to balance user experience and rebases.


Note, we can also optimize rebase perf through mutation batching. Currently we pass in a single mutation to the reducer at a time. This involves many round trips through wasmi which is not very fast. It would be much faster to batch mutations to the reducer allowing reducers to optimize internally. For example, merging many mutations into a single insert/update statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Planning
Development

No branches or pull requests

1 participant