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

Improve performance for Blueprint & Streams Panel for many entities #8808

Open
wants to merge 2 commits into
base: antoine/filt6-blueprint-view-refactor
Choose a base branch
from

Conversation

abey79
Copy link
Member

@abey79 abey79 commented Jan 24, 2025

Related

What

This PR adds an option to ListItem to disable rendering offscreen. In that case, ListItem skips some code and in particular does not call ListItemContent::ui(). The full sizing computation is still run, so it does not affect layout.

Both the blueprint tree and the time panel now opt in to this optimisation.

DNM: chaineded to blueprint tree refactor to minimise conflicts

Benchmark

This optimisation is only measurable in "worst case" scenario, such as fully uncollapsed blueprint tree and streams tree in the air traffic data example. In this case, we shave about 13-15ms off the frame time (90% of which in the time panel) on a M4 Max.

Before/after screenshot (with the view hidden for better frame time stability): (61.8 vs. 47.4ms)

image image

@abey79 abey79 added 🚀 performance Optimization, memory use, etc include in changelog do-not-merge Do not merge this PR labels Jan 24, 2025
Copy link

github-actions bot commented Jan 24, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
707e7f3 https://rerun.io/viewer/pr/8808 +nightly +main

Note: This comment is updated whenever you push a commit.

@Wumpf Wumpf self-requested a review January 24, 2025 16:10
@Wumpf Wumpf changed the title Introduce BlueprintTreeData Improve performance for Blueprint & Streams Panel for many entities Jan 24, 2025
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!

Comment on lines +148 to +150
/// Skipping rendering can increase performances for long lists that are mostly out of view, but
/// this will prevent any side effects from [`ListItemContent::ui`] from occurring. For this
/// reason, this is an opt-in optimization.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clarify, could such a side-effect change the vertical size of a list array? If not, then wouldn't it be reasonable to expect this to be opt-in? I mean we're passing a closure after all for drawing a thing - if the thing isn't on screen, why would you expect your closure to be called; lotsa place don't do that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the vertical size is fully determined by ListItem::height. Also, this change only affects the list item itself, not the fact that it might have children in a collapsing section below it. So there cannot be any issue with vertical layout.

And you are probably right that I'm being overly defensive with this opt-in stuff. I really don't have a strong reason to not make it opt-out (or even always on), except of being scared to break things in untested areas 😅

Copy link
Member

@Wumpf Wumpf Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm I'd really like to make it opt-out in that case, but we can also do this maybe just after the next release then if we're too scared of adding regressions

@abey79 abey79 force-pushed the antoine/list-item-render-offscreen branch from 6aaf2d6 to 707e7f3 Compare January 24, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge Do not merge this PR include in changelog 🚀 performance Optimization, memory use, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants