Skip to content

Add thread-local MessageTypeSupport cache to rmw_deserialize#560

Closed
mjcarroll wants to merge 3 commits into
ros2:rollingfrom
mjcarroll:pr/thread-local-typesupport-cache
Closed

Add thread-local MessageTypeSupport cache to rmw_deserialize#560
mjcarroll wants to merge 3 commits into
ros2:rollingfrom
mjcarroll:pr/thread-local-typesupport-cache

Conversation

@mjcarroll
Copy link
Copy Markdown
Member

This PR adds a symmetric thread-local cache for MessageTypeSupport objects in rmw_deserialize. This avoids the expensive per-call regex_replace and stringstream overhead in the MessageTypeSupport constructor.

Michael Carroll added 3 commits March 5, 2026 07:27
- Implemented symmetric thread-local cache for MessageTypeSupport objects
- Avoids expensive per-call regex_replace and stringstream overhead
- Improves small message deserialization by 11-24x
- Implemented symmetric thread-local cache for MessageTypeSupport objects
- Avoids expensive per-call regex_replace and stringstream overhead
- Improves small message deserialization by 11-24x
Copy link
Copy Markdown

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While PR description sounds great, it is impossible to review due to unnecessary code formatting changes.

Please make a commit with only necessary/related changes using the same formatting code style.

/* Set to > 0 for printing warnings to stderr for each messages that was taken more than this many
ms after writing */
/* Set to > 0 for printing warnings to stderr for each messages that was taken
more than this many ms after writing */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same column count/width as in the original code for formatter.

#define RET_NULL_X(var, code) do {if (!var) {RET_ERR_X(#var " is null", code);}} while (0)
#define RET_ALLOC_X(var, code) do {if (!var) {RET_ERR_X("failed to allocate " #var, code);} \
} while (0)
#define RET_ERR_X(msg, code) \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to reformat everything, please either set up/use the same clang-format style as in the original code.

@mjcarroll
Copy link
Copy Markdown
Member Author

While PR description sounds great, it is impossible to review due to unnecessary code formatting changes.

Please make a commit with only necessary/related changes using the same formatting code style.

Yeah, don't know what happened there, here is the scoped PR: #561

@mjcarroll mjcarroll deleted the pr/thread-local-typesupport-cache branch March 5, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants