MINOR: stream: don't prune variables if the list is empty
The vars_prune() and vars_init() functions involve locking while most of
the time there is no variable at all in streams nor sessions. Let's check
for emptiness before calling these functions. Simply doing this has
increased the multithreaded performance from 1.5 to 5% depending on the
workload.
diff --git a/src/proto_http.c b/src/proto_http.c
index 48cb383..39900de 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -7566,8 +7566,10 @@
memset(s->res_cap, 0, fe->nb_rsp_cap * sizeof(void *));
}
- vars_prune(&s->vars_txn, s->sess, s);
- vars_prune(&s->vars_reqres, s->sess, s);
+ if (!LIST_ISEMPTY(&s->vars_txn.head))
+ vars_prune(&s->vars_txn, s->sess, s);
+ if (!LIST_ISEMPTY(&s->vars_reqres.head))
+ vars_prune(&s->vars_reqres, s->sess, s);
}
/* to be used at the end of a transaction to prepare a new one */