rerun-io / rerun

Visualize streams of multimodal data. Free, fast, easy to use, and simple to integrate. Built in Rust.
https://rerun.io/
Apache License 2.0
6.68k stars 338 forks source link

Slow rendering causes data ingestion to be even slower #7678

Open kpreid opened 1 month ago

kpreid commented 1 month ago

Problem: Suppose that

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:

https://github.com/rerun-io/rerun/blob/06cfa9eb1c8facb435bf7de6991aa0513781e8a6/crates/viewer/re_viewer/src/app.rs#L1192-L1195

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:

(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.)

teh-cmc commented 1 month ago

See:

which lead to:

which requires: