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

Use rerun::Collection almost everywhere we'd use std::vector before #4247

Merged
merged 24 commits into from Nov 17, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Nov 16, 2023

What

... and various improvements to rerun::Collection in general to be up for the task. Added copy assignment/construction, added vector conversion, removed serialization method (handled at callsites now)

Also, I overhauled and generalized our builtin rerun::CollectionAdapters further. They give now more exact guarantees on when they copy & move data.
To support the considerably increased significance and abilitites of this data structure I added a lot more tests, in particular checking on the aforementioned move/copy guarantees.

Huge thanks to @AnkeAnke for pointing out to me how we can support std compatible contains generically in a trivial way (rerun::type_traits::value_type_t!). This made it possible that this PR requires almost no changes in user/test/example code since most types just snap in the same as before.

As expected this change improves the performance on the image logging benchmark (which logs 4 16k rgba images).
Timing on M1 Max went from ~2.9s to ~2.4s and on the AMD windows box I use from ~3.0s to ~2.5s
(did a bunch of runs, values are excluding prepare and process setup, AMD fluctuates a lot)

DRAFT until I'm sure this works on more compilers.

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 demo.rerun.io (if applicable)
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@Wumpf Wumpf added enhancement New feature or request 🌊 C++ API C or C++ logging API include in changelog labels Nov 16, 2023
@Wumpf Wumpf marked this pull request as ready for review November 16, 2023 14:47
and namespace some macros while we're touching that
@emilk emilk self-requested a review November 16, 2023 18:08
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Whoa, that's a lot of complex C++ 😓
Looks good though!

namespace archetypes {

#ifdef EDIT_EXTENSION
#if 0
Copy link
Member

Choose a reason for hiding this comment

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

#if 0 looks wrong, though I know it is right. Perhaps add a comment, or standardize how we do this

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm. Need to do a pass over these. Slowly switched to the simpler if 0 variant because the other thing got implemented incorrectly too often

rerun_cpp/src/rerun/archetypes/segmentation_image_ext.cpp Outdated Show resolved Hide resolved
rerun_cpp/src/rerun/collection.hpp Outdated Show resolved Hide resolved
rerun_cpp/src/rerun/collection.hpp Outdated Show resolved Hide resolved
return data();
}

/// TODO(andreas): Return proper iterator
Copy link
Member

Choose a reason for hiding this comment

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

Why? A raw pointer has the benefit of being simple and much, much faster in debug builds

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, but it will break down soon once we have strides

rerun_cpp/src/rerun/collection_adapter_builtins.hpp Outdated Show resolved Hide resolved
rerun_cpp/src/rerun/collection_adapter_builtins.hpp Outdated Show resolved Hide resolved
rerun_cpp/src/rerun/collection_adapter_builtins.hpp Outdated Show resolved Hide resolved
@Wumpf Wumpf merged commit 907d006 into main Nov 17, 2023
42 checks passed
@Wumpf Wumpf deleted the andreas/cpp/rerun-collection-fields branch November 17, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C or C++ logging API enhancement New feature or request include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants