Skip to content

Use a wrapper for point cloud iterators in order to allow reusing them

During the analysis with our tooling, it was found that re-initializing the point cloud iterators when adding new points to a point cloud is a significant bottleneck. This is due to the implementation of PointCloud2IteratorBase<...>::set_field which does a costly look-up of the field offset using the field as a string.

The wrapper class is needed as the iterators are not default constructable and heap allocations are not allowed.

While we do see some unexpected variations in our measurements (especially for the total runtime of each module) which we are still investigating, generally this set of patches improves the performance for us. For example, for our test system (Intel Core i7-6700HQ @ 2.60GHz × 8, 40 GB RAM, Ubuntu 18.04, ROS 2 Dashing, Autoware.auto (Hash: dba2158e)), the following performance improvements could be measured:

ray_ground_classifier: ~x1.7
velodyne_cloud: ~x1.7
(as a combination of the branches: walbroel.add_point, walbroel.iterative_quick_sort, walbroel.less_operator and walbroel.fast_atan2).

Merge request reports