MINOR: trace: replace the trace() inline function with an equivalent macro
authorWilly Tarreau <w@1wt.eu>
Sat, 10 Apr 2021 17:20:01 +0000 (19:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 10 Apr 2021 17:27:41 +0000 (19:27 +0200)
commitad14c2681b957039825cfbe78223d4281f4b783c
treeab5bc5f0e962fb6fce294a03e10ea728ed77f89d
parent9057a0026ea9b40744f2eaa91d9540c9bd410079
MINOR: trace: replace the trace() inline function with an equivalent macro

The trace() function is convenient to avoid calling trace() when traces
are not enabled, but there starts to be some callers which place complex
expressions in their trace calls, which results in all of them to be
evaluated before being passed as arguments to the trace() function. This
needlessly wastes precious CPU cycles.

Let's change the function for a macro, so that the arguments are now only
evaluated when the surce has traces enabled. However having a generic
macro being called "trace()" can easily cause conflicts with innocent
code so we rename it "_trace".

Just doing this has resulted in a 2.5% increase of the HTTP/1 request rate.
include/haproxy/trace.h