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

IntervalBinaryTree might require auto-balancing #7

Open
alexandercerutti opened this issue Aug 20, 2023 · 0 comments
Open

IntervalBinaryTree might require auto-balancing #7

alexandercerutti opened this issue Aug 20, 2023 · 0 comments
Labels
domain:server 🙏 help wanted Extra attention is needed

Comments

@alexandercerutti
Copy link
Owner

alexandercerutti commented Aug 20, 2023

When a document is well-composed (no unordered cues, correct timings, etc.) or perhaps streamed (during live content), the Interval Binary Tree beneath the Tracks, will be an all-right tree. This might lead, potentially, to higher retrieving time to reach the last element to show as the current time increases (as we have to navigate the whole tree on the right - e.g. when the content is in the middle of its duration).

The solution is to let it auto-balance, which is an AVL-Tree feature (it can be seen here) when new cues are available. This would let us cut in half the time to retrieve the time of retrieving.

Of course, the discussion is open (if anyone will ever read this 😄) and to implement an auto-balancing, we should decide first a limit after which the balancing is needed.

A little concern that comes to my mind is that auto-balancing could be decided to be performed in as small as possible chunks, as it might require some time (depending on the number of cues in the tree). Even if it is decided to be performed as a micro-queue activity, it should be performed as fast as possible to not block the retrieving of the current cues, which happens through a setTimeout (hence "macro-queue" or whatever is it called).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:server 🙏 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant