-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Room List - Store sorted rooms in skip list #29345
Conversation
This data structure stores rooms in a given sorted order and allows for very fast insertions and deletions.
We don't want the store to be created if the labs flag is off
import { RecencySorter } from "./skip-list/sorters/RecencySorter"; | ||
import { AlphabeticSorter } from "./skip-list/sorters/AlphabeticSorter"; | ||
|
||
export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> { |
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.
I've added this class so that we can create a minimal view model for the UI work. I will implement the onAction
method for dealing with updates after I get filters and spaces working.
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.
I've moved the store to #29357
Probably best to include this PR with the minimal vm implmentation
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.
Please explain your rationale in choosing a probabilistic data structure vs something like a binary search tree
Skip lists as just as fast as trees but so much easier to implement and reason about. No rebalancing necessary etc.. |
This PR uses a skip list to sort and store a given array of rooms. Insertion and deletion into the sorted list is very performant.
https://en.wikipedia.org/wiki/Skip_list