Improve asymptotics of merge-tree reconnect#11220
Merged
Abe27342 merged 27 commits intomicrosoft:mainfrom Aug 15, 2022
Merged
Conversation
added 10 commits
July 19, 2022 14:44
…to partial-lengths-doc
…to partial-lengths-doc
Abe27342
commented
Jul 21, 2022
added 7 commits
July 27, 2022 10:32
Abe27342
commented
Jul 29, 2022
Collaborator
⯅ @fluid-example/bundle-size-tests: +7.28 KB
Baseline commit: dca1cbe |
Contributor
|
there is another place we do a similar costly walk: packages\dds\matrix\src\permutationvector.ts would be good to ensure we can support that case as well. |
anthony-murphy
approved these changes
Aug 11, 2022
Contributor
anthony-murphy
left a comment
There was a problem hiding this comment.
looks good. added some comments that are mainly around maintainability here, but logic looks sound. please also get an issue filed for the matrix usage.
Contributor
Author
Filed AB#1577 for this. Looks not too bad. |
Contributor
|
This commit is queued for merging with the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The previous implementation of
regeneratePendingOpnecessitated a linear walk over segments of the merge tree.This strategy can be improved by augmenting the
partialLengthsstructures stored at each block with information about unacked segments.However, that information isn't particularly cheap or straightforward to update: it could be done at the same asymptotic cost, but would likely add some undesirable constant factors to the partial lengths bookkeeping (which already needs to be updated on each insert/delete/structural change).
As a compromise, this adds the ability to optionally compute local partial length information to
PartialSequenceLengths, with the restriction that it's invalidated on update.This is sufficient for the reconnect flow, which regenerates all outstanding local ops upon reconnection without interleaving new ops.
Overall, for a merge tree with
Nsegments and some maximum collab window size, this reduces the cost of rebasingMlocal ops fromO(NM)toO(N + Mlog(N)).