When evaluating an ACL, each expression starts with a memset(0) on the
local sample before calling sample_process(). This is a waste, as the
comment clearly says that the goal is to reset ctx and flags (i.e. 52
bytes), not the whole 144 (no need to erase a possibly older IPv6
address). Let's just do precisely that, because tests with many ACLs
show that up to 1.5% CPU is spent there with a few tens of rules, and
this memset() alone is responsible for 12-20% of the whole function's
time for short matches.
acl_res = ACL_TEST_FAIL;
list_for_each_entry(expr, &acl->expr, list) {
/* we need to reset context and flags */
- memset(&smp, 0, sizeof(smp));
+ memset(&smp.ctx, 0, sizeof(smp.ctx));
+ smp.flags = smp.opt = 0;
fetch_next:
if (!sample_process(px, sess, strm, opt, expr->smp, &smp)) {
/* maybe we could not fetch because of missing data */