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
There seems to be a superfluous va_copy call in rcutils_char_array_vsprintf.
I cannot asses whether this has a relevant impact wrt logging perfomance, but given recent PR about optimization #381 I assume it's worth mentioning to those who know better than me. :-)
If I understand correctly, va_copy copies *args into args_clone for rcutils_char_array_vsprintf:
However, rcutils_char_array_vsprintf doc states "The va_list args will be cloned before being used, so a user can safely use it again after calling this function."
This seems indeed correct, as rcutils_char_array_vsprintf passes args to _rcutils_char_array_vsprintf, which has its own va_copy:
There seems to be a superfluous
va_copy
call inrcutils_char_array_vsprintf
.I cannot asses whether this has a relevant impact wrt logging perfomance, but given recent PR about optimization #381 I assume it's worth mentioning to those who know better than me. :-)
If I understand correctly,
va_copy
copies*args
intoargs_clone
forrcutils_char_array_vsprintf
:rcutils/src/logging.c
Lines 1313 to 1321 in 17dbbec
However,
rcutils_char_array_vsprintf
doc states "Theva_list args
will be cloned before being used, so a user can safely use it again after calling this function."This seems indeed correct, as
rcutils_char_array_vsprintf
passesargs
to_rcutils_char_array_vsprintf
, which has its ownva_copy
:rcutils/src/char_array.c
Lines 166 to 198 in 17dbbec
rcutils/src/char_array.c
Lines 151 to 164 in 17dbbec
So it might be a simple optimization to simply remove the
va_list / va_copy
inrcutils_char_array_vsprintf
.The text was updated successfully, but these errors were encountered: