Repository navigation
Feature/optmize message navigation using windowing strategy - #894
Conversation
…terator enhancements Signed-off-by: Bezerra Luiz, (Luiz.Bezerra@ctw.bmwgroup.com) <198787532+luiz-bezerra-ctw-bmwgroup-com_QCOM@users.noreply.github.com>
There was a problem hiding this comment.
first.mov
This is the problem with the button not being disabled from the start. You have it enabled and think that you can move back, but you can't (the starting point just hasn't been calculated yet).
https://github.com/user-attachments/assets/f679965a-4bd5-40ef-940f-c47125ddc67c
The same goes for when you're loading parts of the data. What ends up happening is you create false positives, where the user thinks they're moving forward or backwards, but nothing is really happening.
I don't think this should be blocking though. I do think this is the best that you can have right now with the way the app is built.
You can either have a more conservative approach where you block moves to next/prev message and end up with a long wait time and users thinking the button is stuck, or you have a more optimistic approach where you allow the clicks but disable the button, with nothing happening when the user clicks it.
let me know what you think @luiz-bezerra-ctw-bmwgroup-com_QCOM
| import isDesktopApp from "@lichtblick/suite-base/util/isDesktopApp"; | ||
|
|
||
| import { FramePromise } from "./pauseFrameForPromise"; | ||
| import { MessagePipelineContext } from "./types"; |
There was a problem hiding this comment.
I think the linting is still not fixed
|
|
A thing that I noticed during testing is that unless you have the topic you want to seek next message selected you can really tell that it's doable to do that. I feel like it's hard to notice |
Yah, any suggestion about how can we improve the UI to show the user that they can move on to the next/prev message in the topic? Perhaps a tooltip when hovering over the buttons? Note that the buttons are initially disabled. |
I think a future improvement could be always highlighting the buttons if that current topic is being used, and doesnt need to be selected |



User-Facing Changes
Description
This document describes the performance optimizations implemented for topic message navigation in the Lichtblick application.
Problem
When navigating through messages in topics with large datasets (e.g., 50,000+ messages), the original implementation would iterate from the beginning of the topic every time, resulting in:
Example Scenario
Solution
1. Enhanced
getBatchIteratorAPIUpdated the
Player.getBatchIteratorinterface to accept optionalstartandendtime parameters:This allows the iterator to seek directly to a specific time range instead of always starting from the beginning.
2. Optimized Next Message Navigation
Strategy: Start iteration from
currentTimeinstead of the beginning.Performance Improvement:
3. Adaptive Window Search for Previous Message
Challenge: Finding the previous message requires knowing the last message before currentTime, which is harder when iterating forward.
Strategy: Hybrid adaptive window approach
Calculate Initial Window based on topic statistics:
Progressive Window Expansion:
Iterate Only Within Window:
Performance Improvement:
4. Helper Functions
Created
timeWindowHelpers.tswith utilities:subtractMilliseconds(): Safe time arithmetic with nanosecond handlingcalculateOptimalWindowMs(): Compute ideal window based on message densitycreateWindowSizes(): Generate progressive window sequencewouldReachBoundary(): Check if window reaches topic boundary5. Backward Compatibility
The
optionsparameter is optional, ensuring backward compatibility:Performance Benchmarks
Real-world Scenario: 50,000 Message MCAP
Conclusion
This optimization provides 100-300x performance improvement for navigation in large topics, transforming a previously frustrating multi-second wait into an instant ~10-30ms response time.
Checklist