-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved automatic view creation heuristic, major speedup for scenes …
…with many entities (#4874) ### What What space views get spawned is no longer determined by a centralized heuristic, but instead by one distributed to each space view class. Each of those heuristics can make much better use of existing information provided by store subscribers. * Fixes most of #4388 * a few things on the tracking issue still left to investigate * Fixes #3342 * more "obsoleted" arguably: We originally had a hack that 1d tensor logging would display a bar chart. That's not actually desirable. There is still the open issue for the _query_ now to not rely exclusively on indicators, but automatic view spawning is encouraged to do so. (Overall the workings and fault lines of these systems have shifted a lot since the ticket was filed.) * Fixes #4695 * Looks like this now: ![image](https://github.com/rerun-io/rerun/assets/1220815/a77e7768-0d4f-4045-b5a2-980e49955c31) * Fixes #4689 * Fixes #3079 Significant speedup for scenes with many entities (100+): `opf --no-frames` before: `App::update` 39.0ms, of which `default_created_space_views` 10.4ms after: `App::update` 27.4ms, of which `default_created_space_views` 0.17ms `python/tests/many_entities (1000 individual points)` before: `App:::update` 151ms, of which `default_created_space_views` 124ms after: `App::update` 22.6ms, of which `default_created_space_views` 0.06ms (_still pretty bad, but less so and for different reasons now!_) (numbers from my macbook on a release build. Actual numbers might differ by now, these are from last week. ) ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/4874/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/4874/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/4874/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/4874) - [Docs preview](https://rerun.io/preview/ce72c01b3379c20b43d3cdbbe44c37dce2a94f5c/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/ce72c01b3379c20b43d3cdbbe44c37dce2a94f5c/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
- Loading branch information
Showing
40 changed files
with
657 additions
and
592 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use re_log_types::EntityPathFilter; | ||
use re_viewer_context::{ | ||
ApplicableEntities, IdentifiedViewSystem, RecommendedSpaceView, SpaceViewClass, | ||
SpaceViewSpawnHeuristics, ViewerContext, VisualizerSystem, | ||
}; | ||
|
||
/// Spawns a space view for each single entity which is visualizable & indicator-matching for a given visualizer. | ||
/// | ||
/// This is used as utility by *some* space view types that want | ||
/// to spawn a space view for every single entity that is visualizable with a given visualizer. | ||
pub fn suggest_space_view_for_each_entity<TVisualizer>( | ||
ctx: &ViewerContext<'_>, | ||
space_view: &impl SpaceViewClass, | ||
) -> SpaceViewSpawnHeuristics | ||
where | ||
TVisualizer: VisualizerSystem + IdentifiedViewSystem + Default, | ||
{ | ||
re_tracing::profile_function!(); | ||
|
||
let Some(indicator_matching_entities) = ctx | ||
.indicated_entities_per_visualizer | ||
.get(&TVisualizer::identifier()) | ||
else { | ||
return Default::default(); | ||
}; | ||
let Some(applicable_entities) = ctx | ||
.applicable_entities_per_visualizer | ||
.get(&TVisualizer::identifier()) | ||
else { | ||
return Default::default(); | ||
}; | ||
|
||
let visualizer = TVisualizer::default(); | ||
let recommended_space_views = applicable_entities | ||
.intersection(indicator_matching_entities) | ||
.filter_map(|entity| { | ||
let context = space_view.visualizable_filter_context(entity, ctx.entity_db); | ||
if visualizer | ||
.filter_visualizable_entities( | ||
ApplicableEntities(std::iter::once(entity.clone()).collect()), | ||
context.as_ref(), | ||
) | ||
.is_empty() | ||
{ | ||
None | ||
} else { | ||
Some(RecommendedSpaceView { | ||
root: entity.clone(), | ||
query_filter: EntityPathFilter::single_entity_filter(entity), | ||
}) | ||
} | ||
}) | ||
.collect(); | ||
|
||
re_viewer_context::SpaceViewSpawnHeuristics { | ||
recommended_space_views, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.