Is it stupid to use unbounded dynamic arrays in ROS2 perforamnce test?

asked 2023-03-23 09:51:06 -0500

Envilon gravatar image

Hi, I'm using ROS2 and I would like to do some performance tests for communication latency between service server and service client. The tests would compare ROS to ROS communication and ROS to Unity communication. Because the ROS to Unity integration is done via an additional TCP endpoint, I would like to measure the additional latency (for various message sizes, on various systems, and various implementations of the service...).

I created a custom service interface that would send a payload of various sizes as a request and the service server would send the same payload back to the client as a response. For the payload I used unbounded dynamic array of bytes (byte[]) so the client node can gradually increase the size during its runtime. However, I've seen some message passing performance tests that were using different message interface for different payload size. So I was wondering if there is a reason not to use my approach.

The only suspicion I have is that some internal structures could allocate more space preemptively (like std::vector is doing for example) so I would actually be sending different payload size than I am expecting. Is this happening in the background?

Thank you for your insights.

edit retag flag offensive close merge delete