Optimized deserialization from sensor_msgs/PointCloud2 #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm submitting this PR to optimize the deserialization of sensor_msgs/PointCloud2 into libpointmatcher/DataPoints.
For this PR I tried to reduce the original deserialization code size, move different parts into separate functions, and:
Rely on a sensor_msgs/PointCloud2Iterator instead of raw pointers.
Move the RemoveNaNDataPointsFilter out of the deserialization. This could be done afterwards.
Added setup for compiling doxygen comments and running unit tests.
In progress:
I've run some benchmarks on my laptop, and found that the new deserializer is running 3-5x faster than the previous implementation. According to Intel VTune, the previous implementation was getting vectorized to SSE3, but retired many more instructions per cycle than the new one. Do note that I still don't consider the performance of the new deserializer to be the best possible, but I think it is a positive improvement over the previous implementation. I'm following up on that here: ros2/common_interfaces#133
All feedback is warmly welcome.
PS: The code has been formatted using the clang format style sheet from this PR: norlab-ulaval/libpointmatcher#289