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

Refactor the 2D heuristic again #5166

Merged
merged 7 commits into from
Feb 12, 2024
Merged

Refactor the 2D heuristic again #5166

merged 7 commits into from
Feb 12, 2024

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Feb 9, 2024

What

Adds a store subscriber for tracking the dimensions of image entities.

Gets rid of the previous bucketing logic and replaces it with a new implementation that starts at the top of the subspace and incrementally splits when it finds conflicting image entities within the space.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

@jleibs jleibs added heuristics Heuristics for placing views, fallback provider, etc. 🦟 regression A thing that used to work in an earlier release exclude from changelog PRs with this won't show up in CHANGELOG.md and removed 🦟 regression A thing that used to work in an earlier release labels Feb 9, 2024
@jleibs jleibs marked this pull request as ready for review February 9, 2024 22:29
@emilk emilk requested a review from Wumpf February 12, 2024 08:39
Base automatically changed from jleibs/no_redundant_space_view to main February 12, 2024 10:13
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.

I like the new recursive approach, it feels a lot simpler.
The key innovations here for robustness is clearly the store subscriber + automatic common-ancestor picking for the root

Doing some more testing & comment based fixups, then merging

Comment on lines +18 to +32
impl MaxImageDimensions {
/// Accesses the image dimension information for a given store
pub fn access<T>(
store_id: &StoreId,
f: impl FnOnce(&IntMap<EntityPath, ImageDimensions>) -> T,
) -> Option<T> {
re_data_store::DataStore::with_subscriber_once(
MaxImageDimensionSubscriber::subscription_handle(),
move |subscriber: &MaxImageDimensionSubscriber| {
subscriber.max_dimensions.get(store_id).map(|v| &v.0).map(f)
},
)
.flatten()
}
}
Copy link
Member

Choose a reason for hiding this comment

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

so annoying to ahve to repeat this boilerplate. Store subscriber needs a builtin layer for this...

crates/re_space_view_spatial/src/space_view_2d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/space_view_2d.rs Outdated Show resolved Hide resolved
@Wumpf Wumpf force-pushed the jleibs/heuristic_image_splits branch from dad4aee to 015ba75 Compare February 12, 2024 10:24
@Wumpf Wumpf force-pushed the jleibs/heuristic_image_splits branch from bf16bd5 to da9a0d2 Compare February 12, 2024 10:29
@Wumpf
Copy link
Member

Wumpf commented Feb 12, 2024

testing with opf --no-frames: spawn_heuristics for 2D costs me 0.13ms on release, so definitly got slower. Not amazing but don't care about this overhead right now. Interestingly we got quite heavy losses in property heuristics. whopping 1.2ms, but this wasn't this PR and it's not critical at this point

@Wumpf Wumpf merged commit fc9f64f into main Feb 12, 2024
40 of 41 checks passed
@Wumpf Wumpf deleted the jleibs/heuristic_image_splits branch February 12, 2024 10:48
Wumpf added a commit that referenced this pull request Feb 12, 2024
### What
 - Builds on top of #5164

Adds a store subscriber for tracking the dimensions of image entities.

Gets rid of the previous bucketing logic and replaces it with a new
implementation that starts at the top of the subspace and incrementally
splits when it finds conflicting image entities within the space.

### 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/5166/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5166/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/5166/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
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5166)
- [Docs
preview](https://rerun.io/preview/da9a0d206235016d14d9826e8c42ed8481d29643/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/da9a0d206235016d14d9826e8c42ed8481d29643/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md heuristics Heuristics for placing views, fallback provider, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants