Open koonpeng opened 3 years ago
Wow, that's really a BIG progress and optimization. ref
is one of the most important dependency for rclnodejs
, although it facilitate the development in the beginning, we have to depend on it heavily, and actually, we have met some problem that we cannot fix because of ref
.
We can gain a lot if we can use c library directly, the performance improvement you mentioned is signification! I will read the code carefully in the following days, thanks!
This introduces is a new message binding system that uses native c code from
rosidl_generator_c
that I have been experimenting with. As this is a pretty big change to the core systems, it is turned off by default. Right now it's working for our use cases which most consist of pub/sub and service clients, I also managed to get it working on node v14 as it does not use ref.Below description copied from the README gives a more detailed explaination on the new bindings.
In order to use the new bindings, you must either:
set RCLNODEJS_USE_ROSIDL=1 environment variable. or add a
.npmrc
file in your project directory withrclnodejs_use_rosidl=true
.The new experimental message bindings uses ros interfaces to perform serialization. The main advantage of the new bindings is better performance, it is ~25% faster for large messages (1mb) and ~800% faster for small messages (1kb). It is also safer as memory is managed by v8, you will no longer get undefined behaviors when you try to reference a message outside the subscription callbacks. Also as a result of moving to v8 managed memory, it fixes some memory leaks observed in the current bindings.
The downside is that the new bindings is not API compatible, it does a number of things differently.
std_msg
wrappers are not supported.