carla-simulator / ros-bridge

ROS bridge for CARLA Simulator
MIT License
524 stars 431 forks source link

[lidar] speedup create_cloud #614

Open PierrickKoch opened 2 years ago

PierrickKoch commented 2 years ago

Up to 4000 times faster, depending on points cloud size. Don't use struct pack_into over each point, copy numpy raw buffer instead.

[1] https://gist.github.com/PierrickKoch/01181660d3427990db64056df43257a5#file-lidar_timeit-py [2] https://github.com/eric-wieser/ros_numpy/blob/master/src/ros_numpy/point_cloud2.py [3] https://github.com/numpy/numpy/blob/main/numpy/core/src/multiarray/multiarraymodule.c#L2248


This change is Reviewable

ksuszka commented 2 years ago

Isn't this duplicate of https://github.com/carla-simulator/ros-bridge/pull/557 ? In any case it would be nice to have one of those merged.