Skip to content

Commit b9fbd8f

Browse files
Expand on dynamic vs static type support: tradeoff, impl decision
Signed-off-by: Christophe Bedard <[email protected]>
1 parent 8917e2b commit b9fbd8f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/Tutorials/Advanced/Creating-An-RMW-Implementation.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ On the other hand, dynamic type support involves generating a bit of middleware-
201201

202202
This information can be used at runtime by any ``rmw`` implementation to interpret a type-erased pointer to data: names & types of fields, functions to read from/write to fields depending on their type, functions to get the size of an array field, etc.
203203
For C++, this is ``rosidl_typesupport_introspection_cpp``, which is used by ``rmw_fastrtps_dynamic_cpp`` (hence the "dynamic" part), for example.
204-
Dynamic type support is generally slower than static type support at runtime, but it does not require generating middleware-specific code.
204+
205+
Dynamic type support is generally slower than static type support at runtime because it has to iterate over each message field, figure out what type it is, and then process it, e.g., serialize it.
206+
Static type support knows exactly how to process the message thanks to the code it generated for each interface type.
207+
This is why most ``rmw`` implementations use static type support.
208+
However, dynamic type support does not require generating middleware-specific code.
209+
Choosing between static and dynamic type support is an orthogonal decision to the ``rmw`` implementation itself.
205210

206211
``rmw_email_cpp`` uses dynamic type support to convert messages to and from YAML string to be sent over email.
207212
It gets the type support introspection information, and passes it and the message to an external/experimental package, `dynmsg <https://github.com/osrf/dynamic_message_introspection/>`_, which converts the message to/from YAML.

0 commit comments

Comments
 (0)