]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib: event filter - Avoid using event name wildcard matching when not needed
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Fri, 30 Apr 2021 16:41:55 +0000 (12:41 -0400)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 May 2021 11:42:42 +0000 (11:42 +0000)
commit33e01c1c3023726cf34d262d08810b6f0150c41f
treeb8a1a69722e13101dc80f0be47bc9cb2c7996aed
parentaa6edb3499a4db4a73d6c21118bb4409220999d2
lib: event filter - Avoid using event name wildcard matching when not needed

If the right hand side of an event name comparison is not using any
wildcards, we can compare using strcmp() instead of the more expensive
wildcard_match().

This wildcard matching avoidance change speeds up matching quite a bit.
When the desired comparison is *not* a wildcard match (i.e., the filter is
'event=abc'), microbenchmarks show at least a 30% speedup in filter matching
speed.  When the comparison includes a wildcard (i.e., the filter is
'event=abc*'), microbenchmarks show approximately 0.4% filer matching
slowdown.

Since there are so many non-wildcard matches in a typical filter, this is a
very good trade-off.
src/lib/event-filter-parser.y
src/lib/event-filter-private.h
src/lib/event-filter.c