@@ -7,6 +7,7 @@ Performance benchmarks for comparing ROS 2 client libraries: C++ (rclcpp), Pytho
771 . ** ROS 2** : Install from [ ros.org] ( https://docs.ros.org/en/jazzy/Installation.html )
882 . ** Node.js** : v16+ for rclnodejs (from [ nodejs.org] ( https://nodejs.org/ ) )
993 . ** rclnodejs** : Follow [ installation guide] ( https://github.com/RobotWebTools/rclnodejs#installation )
10+ 4 . ** Build Dependencies** : For C++ benchmarks: ` sudo apt install libssl-dev cmake build-essential `
1011
1112## Benchmark Structure
1213
@@ -16,55 +17,59 @@ Each client library has identical benchmark tests:
1617| ----------- | ------------------------------------------- |
1718| ** topic** | Publisher/subscriber performance |
1819| ** service** | Client/service request-response performance |
19- | ** startup** | Node initialization time |
2020
2121## Performance Results
2222
2323### Test Environment
2424
2525** Hardware:**
2626
27- - ** CPU:** Intel(R) Core(TM) i9-10900X @ 3.70GHz (10 cores, 20 threads)
28- - ** Memory:** 32GB RAM
27+ - ** CPU:** 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (4 cores, 8 threads)
28+ - ** Memory:** 8GB RAM
2929- ** Architecture:** x86_64
3030
3131** Software:**
3232
3333- ** OS:** Ubuntu 24.04.3 LTS (WSL2)
34+ - ** Kernel:** 6.6.87.2-microsoft-standard-WSL2
3435- ** ROS 2:** Jazzy distribution
35- - ** C++ Compiler:** GCC 13.3.0
36+ - ** C++ Compiler:** GCC 13.3.0 (Ubuntu 13.3.0-6ubuntu2 ~ 24.04)
3637- ** Python:** 3.12.3
3738- ** Node.js:** v22.18.0
3839
3940### Benchmark Results
4041
4142Benchmark parameters: 1000 iterations, 1024KB message size
4243
43- | Client Library | Topic (ms) | Service (ms) | Performance Ratio |
44- | ----------------------- | ---------- | ------------ | ---------------------- |
45- | ** rclcpp (C++)** | 437 | 8,129 | Baseline (fastest) |
46- | ** rclpy (Python)** | 2,294 | 25,519 | 5.3x / 3.1x slower |
47- | ** rclnodejs (Node.js)** | 2,075 | 3,420 \* | 4.7x / 2.4x faster \*\* |
44+ | Client Library | Topic (ms) | Service (ms) | Performance Ratio |
45+ | ----------------------- | ---------- | ------------ | ------------------- |
46+ | ** rclcpp (C++)** | 168 | 627 | Baseline (fastest) |
47+ | ** rclpy (Python)** | 1,618 | 15,380 | 9.6x / 24.5x slower |
48+ | ** rclnodejs (Node.js)** | 744 | 927 | 4.4x / 1.5x slower |
4849
49- _ Last updated: August 29 , 2025_
50+ _ Last updated: August 30 , 2025_
5051
5152** Notes:**
5253
5354- Topic benchmarks: All libraries completed successfully with 1024KB messages
54- - Service benchmarks: C++ and Python completed with 1024KB responses; Node.js completed with minimal data
55- - \* Node.js service uses minimal response data due to serialization issues with large (1024KB) payloads
56- - \*\* Node.js service performance is surprisingly good with small data, but not directly comparable due to different data sizes
55+ - Service benchmarks: All libraries completed successfully with 1024KB responses
5756- Performance ratios are relative to C++ baseline
57+ - C++ shows excellent performance as expected for a compiled language
58+ - Node.js performs significantly better than Python, likely due to V8 optimizations
59+ - Python service performance shows significant overhead with large payloads compared to topics
5860
5961## Running Benchmarks
6062
6163### C++ (rclcpp)
6264
6365``` bash
6466cd benchmark/rclcpp/
65- colcon build
66- ./build/rclcpp_benchmark/publisher-stress-test -r 1000 -s 1024
67- ./build/rclcpp_benchmark/client-stress-test -r 1000
67+ mkdir -p build && cd build
68+ source ~ /Download/ros2-linux/local_setup.bash # Adjust path
69+ cmake .. && make
70+ # Run from build directory:
71+ ./publisher-stress-test -r 1000 -s 1024
72+ ./client-stress-test -r 1000
6873```
6974
7075### Python (rclpy)
@@ -94,26 +99,26 @@ For complete tests, run subscriber/service first, then publisher/client:
9499``` bash
95100# Terminal 1: Start subscriber (adjust for your language)
96101python3 topic/subscription-stress-test.py # Python
97- ./build/rclcpp_benchmark/ subscription-stress-test # C++
102+ ./subscription-stress-test # C++ (from build dir)
98103node benchmark/rclnodejs/topic/subscription-stress-test.js # Node.js
99104
100105# Terminal 2: Run publisher benchmark
101106python3 topic/publisher-stress-test.py -r 1000 -s 1024 # Python
102- ./build/rclcpp_benchmark/ publisher-stress-test -r 1000 -s 1024 # C++
107+ ./publisher-stress-test -r 1000 -s 1024 # C++ (from build dir)
103108node benchmark/rclnodejs/topic/publisher-stress-test.js -r 1000 -s 1024 # Node.js
104109```
105110
106111** Service Test:**
107112
108113``` bash
109114# Terminal 1: Start service (adjust for your language)
110- python3 service/service-stress-test.py # Python
111- ./build/rclcpp_benchmark/ service-stress-test # C++
112- node benchmark/rclnodejs/service/service-stress-test.js # Node.js
115+ python3 service/service-stress-test.py -s 1024 # Python
116+ ./service-stress-test -s 1024 # C++ (from build dir)
117+ node benchmark/rclnodejs/service/service-stress-test.js -s 1024 # Node.js
113118
114119# Terminal 2: Run client benchmark
115120python3 service/client-stress-test.py -r 1000 # Python
116- ./build/rclcpp_benchmark/ client-stress-test -r 1000 # C++
121+ ./client-stress-test -r 1000 # C++ (from build dir)
117122node benchmark/rclnodejs/service/client-stress-test.js -r 1000 # Node.js
118123```
119124
0 commit comments