[tarantool-patches] [PATCH 3/3] sio: optimize sio_strfaddr() for the most common case

Vladimir Davydov vdavydov.dev at gmail.com
Tue May 14 11:09:32 MSK 2019


On Sun, Apr 28, 2019 at 07:56:27PM +0300, Vladislav Shpilevoy wrote:
> The main motivation behind this commit is that SWIM makes active
> use of sio_strfaddr() for logging - for each received/sent
> message it writes a couple of addresses into a log. It does it in
> verbose mode, but the say() function arguments are still
> calculated even when the active mode is lower than verbose.

They are not as say() is a macro.

At compile time

  say(level, error, format, ...)

is expanded into

  if (say_log_level_is_enabled(level))
          _say(level, file, line, error, format, ...);

That is, neither format nor its arguments are evaluated at runtime
unless say_log_level_is_enabled(level) returns true.



More information about the Tarantool-patches mailing list