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

Slow rendering causes data ingestion to be even slower #7678

Open
kpreid opened this issue Oct 10, 2024 · 1 comment
Open

Slow rendering causes data ingestion to be even slower #7678

kpreid opened this issue Oct 10, 2024 · 1 comment
Labels
😤 annoying Something in the UI / SDK is annoying to use 🚀 performance Optimization, memory use, etc project-many-entities-perf 📺 re_viewer affects re_viewer itself user-request This is a pressing issue for one of our users

Comments

@kpreid
Copy link
Collaborator

kpreid commented Oct 10, 2024

Problem: Suppose that

  • you have a large amount of data to load, and
  • that data is also slow to render — let's say 200 ms per frame.

In this case, the data will be extremely slow to load — but faster if you switch to a different recording that isn't so slow to draw. The culprit, I would guess, is this logic in re_viewer’s message receiving loop:

if start.elapsed() > web_time::Duration::from_millis(10) {
egui_ctx.request_repaint(); // make sure we keep receiving messages asap
break; // don't block the main thread for too long
}

This means that after each 10 ms portion of the data is loaded, the viewer will redraw all the (visible) data loaded so far — which means in my example of 200 ms drawing time, means it's spending 95% of its time redrawing partially-loaded data instead of getting more data loaded, and over the entire process adds up to a total load time that could be as bad as O(N²) (in the worst case where the redraw cost is proportional to the data loaded so far). In the actual scenario that inspired this report, my user experience is like: run application for 2 seconds, exit application, wait 1 minute for the viewer to finish thinking about the data it got.

Possible solutions:

  • Keep the 10 ms interruptions but don’t repaint until a longer period has passed; this would require being able to receive_messages() without doing it inside update().
  • Less refactoring, less good: adjust the 10 ms limit upward whenever drawing is especially slow, which will reduce responsiveness but perhaps still be better on net.
  • Ultimate engineering-heavy solution: concurrent EntityDb that allows the data source to be appending while the renderer is reading.

(Obviously, it would be better if the data wasn’t taking 200 ms to draw in this scenario. But, no matter how efficient the renderer gets, users will always have reasons to push the limits of what is feasible on the hardware they have, so I think it’s worth doing something here.)

@kpreid kpreid added 📺 re_viewer affects re_viewer itself 😤 annoying Something in the UI / SDK is annoying to use 🚀 performance Optimization, memory use, etc 👀 needs triage This issue needs to be triaged by the Rerun team labels Oct 10, 2024
@teh-cmc teh-cmc added user-request This is a pressing issue for one of our users and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😤 annoying Something in the UI / SDK is annoying to use 🚀 performance Optimization, memory use, etc project-many-entities-perf 📺 re_viewer affects re_viewer itself user-request This is a pressing issue for one of our users
Projects
None yet
Development

No branches or pull requests

2 participants