-
Notifications
You must be signed in to change notification settings - Fork 8
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
Initial commit of primitive_array type #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General feedback: This is now getting to the point where it's difficult for me to "simulate" the codepath in my head as I review the PR. I think in cases like these, I'd prefer we write some tests to confirm this logic will continue to work after future changes.
lib/ros_value.h
Outdated
} else { | ||
primitive_info_.~primitive_info_t(); | ||
} | ||
} | ||
RosValue operator=(const RosValue&) { | ||
throw std::runtime_error("Can't call this"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should have a better error message than this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually want to write this, thanks for catching.
@brendangeck I can definitely add some more tests around arrays specifically. The existing tests do a decent job of covering the |
Fixes: DATA-556
Description of Changes
Using pre-allocated
RosValue
s to hold each primitive within an array can be very expensive for large arrays of small data types.This change makes it so that we create a RosValue on the stack to point to an element of these arrays whenever the items are accessed. This involves a few steps:
RosValue::Pointer
s now have two 'underlying definitions': one where we track the location in the dynamic vector, and one where we simply store aRosValue
primitive_array
type which stores primitives (not including strings) which do not haveRosValue
s pre-allocated for them.Test Plan
Verified that a large amount of memory was no longer being used by reading a bag full of CompressedImage messages.