From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 14 May 2019 11:09:32 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH 3/3] sio: optimize sio_strfaddr() for the most common case Message-ID: <20190514080932.czhcqcl6t6dy6sv3@esperanza> References: <01f8b95e78623d7f56cded96324184b8d96cec13.1556470563.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01f8b95e78623d7f56cded96324184b8d96cec13.1556470563.git.v.shpilevoy@tarantool.org> To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org, kostja@tarantool.org List-ID: 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.