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

Performance regression with many poses #7292

Closed
teh-cmc opened this issue Aug 28, 2024 · 3 comments · Fixed by #7300
Closed

Performance regression with many poses #7292

teh-cmc opened this issue Aug 28, 2024 · 3 comments · Fixed by #7300
Labels
🚀 performance Optimization, memory use, etc 📺 re_viewer affects re_viewer itself 🦟 regression A thing that used to work in an earlier release
Milestone

Comments

@teh-cmc
Copy link
Member

teh-cmc commented Aug 28, 2024

Via @Danvil in #7222 (comment):

With branch master (as of 8/27, 3PM PDT) it feels a little bit faster but performance is still lower than rerun 0.16.

I tried some bisection of the rerun visualizations in my application and the bottleneck now seems to be this code:

rr.set_time_seconds("timestamp", my_timestamp);
rr.log("path", &rerun::Clear::recursive())?;
for (i, pose) in path.iter().enumerate() {
    rr.log(format!("{tag}/{i}"), &rerun::Transform3D::from_translation_mat3x3(pose.t3, pose.r3))?;
}

(there are 250 poses)

Without this visualization 0.18 also is much faster. So it seems like a large part of the slowdown from 0.16 to 0.18 is due to visualization of the poses.

@teh-cmc teh-cmc added 📺 re_viewer affects re_viewer itself 🚀 performance Optimization, memory use, etc 🦟 regression A thing that used to work in an earlier release labels Aug 28, 2024
@teh-cmc teh-cmc added this to the 0.18.1 milestone Aug 28, 2024
@jleibs
Copy link
Member

jleibs commented Aug 28, 2024

Any chance the recursive clear is impacting things now that we do query-time clears?

@teh-cmc
Copy link
Member Author

teh-cmc commented Aug 28, 2024

Any chance the recursive clear is impacting things now that we do query-time clears?

The clear in that example snippet doesn't seem to apply to the transforms at all, but maybe that's just a typo? 🤔

In any case i'll try both.

@teh-cmc
Copy link
Member Author

teh-cmc commented Aug 28, 2024

(This will be my ever-involving live-investigation comment)


import rerun as rr

rr.init("rerun_example_transform3d")
rr.save("/tmp/buncha_transforms_without_clear.rrd")

rr.set_time_seconds("timestamp", 42)
for i in range(0, 250):
    rr.log(f"transforms/{i}", rr.Transform3D(translation=[i, 0, 0]))

0.17:
image

main:
image


import rerun as rr

rr.init("rerun_example_transform3d")
rr.save("/tmp/buncha_transforms_with_clear.rrd")

rr.set_time_seconds("timestamp", 42)
rr.log("transforms", rr.Clear(recursive=True))
for i in range(0, 250):
    rr.log(f"transforms/{i}", rr.Transform3D(translation=[i, 0, 0]))

0.17:
image

main:
image

jleibs added a commit that referenced this issue Aug 28, 2024
### What
Resolves: #7292

Halves the time spent in `execute_systems` when using many Transforms.
- TransformContext uses a store subscriper to track which components are
non-empty and only queries those from the store.
- Arrows visualizer no longer queries for overrides on the unused
transform components since those are fetched from the transform context
manager anyways.

Before:

![image](https://github.com/user-attachments/assets/90137375-087a-47ee-8e76-6cb13b46f4cf)

After:

![image](https://github.com/user-attachments/assets/beab559a-2d72-49da-8403-48c057e2a811)


### 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 examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7300?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7300?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)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7300)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
jleibs added a commit that referenced this issue Aug 28, 2024
### What
Resolves: #7292

Halves the time spent in `execute_systems` when using many Transforms.
- TransformContext uses a store subscriper to track which components are
non-empty and only queries those from the store.
- Arrows visualizer no longer queries for overrides on the unused
transform components since those are fetched from the transform context
manager anyways.

Before:

![image](https://github.com/user-attachments/assets/90137375-087a-47ee-8e76-6cb13b46f4cf)

After:

![image](https://github.com/user-attachments/assets/beab559a-2d72-49da-8403-48c057e2a811)


### 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 examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7300?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7300?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)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7300)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 performance Optimization, memory use, etc 📺 re_viewer affects re_viewer itself 🦟 regression A thing that used to work in an earlier release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants