mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-06 12:20:07 +00:00
OPTIM: log: declare empty buffer as global variable
'empty' buffer used in sess_build_logline() inside a loop, and since it is only being read from and not modified, until recently it ended up being cached most of the time and didn't cause overhead due to systematic push on the stack. However, due recent encoding work and new added variables on the stack, we're starting to reach a stack limit and declaring 'empty' buffer within the loop seems to cause non-negligible CPU overhead. Since the variable isn't modified during log generation, let's declare 'empty' buffer as a global variable outside from sess_build_logline() to prevent pushing it on the stack for each node evaluation.
This commit is contained in:
parent
cc2e94a948
commit
728b5aa835
@ -119,6 +119,7 @@ const char *log_levels[NB_LOG_LEVELS] = {
|
||||
|
||||
const char sess_term_cond[16] = "-LcCsSPRIDKUIIII"; /* normal, Local, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */
|
||||
const char sess_fin_state[8] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
|
||||
const struct buffer empty = { };
|
||||
|
||||
|
||||
int prepare_addrsource(struct logformat_node *node, struct proxy *curproxy);
|
||||
@ -3642,7 +3643,6 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
|
||||
const char *src = NULL;
|
||||
const char *value_beg = NULL;
|
||||
struct sample *key;
|
||||
const struct buffer empty = { };
|
||||
|
||||
/* first start with basic types (use continue statement to skip
|
||||
* the current node)
|
||||
|
Loading…
Reference in New Issue
Block a user