You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve the performance of rcutils_logging_format_message. (#372)
In particular, the g_rcutils_logging_output_format_string
can't really change after initialization time, so we don't
need to reparse it every time. Instead, parse it once at
the beginning and just maintain an array of callbacks to
call to fill in the information as each log message comes in.
In my testing, this reduces the cost of calling
rcutils_logging_format_message by about 50% in all cases, from
very short format strings to very long ones.
Format strings with many, many token substitutions are still
very inefficient. That's because once we go beyond the
fixed 2048 buffer limit and start allocating memory, we only
allocate small chunks of memory at a time. However, this
won't come up in most normal situations (including the default
format message), so we ignore this performance problem for now.
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
0 commit comments