-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add indexing structure to accelerate lookups #6
Add indexing structure to accelerate lookups #6
Conversation
|
||
public setMinSeq(minSeq: number): void { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain | ||
while (!this.seqOrdered.empty && this.seqOrdered.first?.data.seq! <= minSeq) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now does nothing if there are not obliterates, and it's at most O(n) for the number of obliterates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're at the minSeq, does that mean that the obliterate should be considered out of the collabWindow? I had been assuming that it was the opposite (===minSeq means still inside collabWindow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minSeq is the lowest seq all clients have seen, so if there is an obliterate at the minSeq it means it was seen by all clients, and therefore shouldn't remove anything more, as only clients that haven't see the obliterate should have their inserts removed.
|
||
public findOverlapping(seg: ISegment): Iterable<ObliterateInfo> { | ||
const overlapping: ObliterateInfo[] = []; | ||
for (const start of this.startOrdered.items) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worst case scenario this is O(n) for the number of obliterates. we could probably accelerate this further with a tree.
No description provided.