From: Willy Tarreau Date: Mon, 30 Nov 2026 19:49:54 +0000 (+0100) Subject: OPTIM: pattern: use ebst_lookup_len() when possible X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static//%22?a=commitdiff_plain;h=b70c8fc2f5dd2e59efbe40092f4789cccd525ad3;p=haproxy.git OPTIM: pattern: use ebst_lookup_len() when possible In pat_match_str(), we're looking up strings using ebst_lookup(), but we know the length and already have ebst_lookup_len() that is made for this purpose, so better rely on it since it's a bit faster. This speeds up request rate by 1% on configs with a few tens of string lookups. --- diff --git a/src/pattern.c b/src/pattern.c index 0f95eeae7..000424178 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -506,7 +506,7 @@ struct pattern *pat_match_str(struct sample *smp, struct pattern_expr *expr, int if (!pat_match_ensure_str(smp)) return NULL; - node = ebst_lookup(&expr->pattern_tree, smp->data.u.str.area); + node = ebst_lookup_len(&expr->pattern_tree, smp->data.u.str.area, smp->data.u.str.data); while (node) { elt = ebmb_entry(node, struct pattern_tree, node);