Use JIT in regex matching if available
This commit is contained in:
16
server/modules/filter/cache/cachefilter.cc
vendored
16
server/modules/filter/cache/cachefilter.cc
vendored
@ -102,6 +102,20 @@ bool cache_command_show(const MODULECMD_ARG* pArgs)
|
||||
return true;
|
||||
}
|
||||
|
||||
int cache_process_init()
|
||||
{
|
||||
uint32_t jit_available;
|
||||
pcre2_config(PCRE2_CONFIG_JIT, &jit_available);
|
||||
|
||||
if (!jit_available)
|
||||
{
|
||||
MXS_WARNING("pcre2 JIT is not available; regex matching will not be "
|
||||
"as efficient as it could be.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -145,7 +159,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
"A caching filter that is capable of caching and returning cached data.",
|
||||
VERSION_STRING,
|
||||
&CacheFilter::s_object,
|
||||
NULL, /* Process init. */
|
||||
cache_process_init, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
|
4
server/modules/filter/cache/rules.cc
vendored
4
server/modules/filter/cache/rules.cc
vendored
@ -532,6 +532,10 @@ static CACHE_RULE *cache_rule_create_regexp(cache_rule_attribute_t attribute,
|
||||
|
||||
if (code)
|
||||
{
|
||||
// We do not care about the result. If JIT is not present, we have
|
||||
// complained about it already.
|
||||
pcre2_jit_compile(code, PCRE2_JIT_COMPLETE);
|
||||
|
||||
int n_threads = config_threadcount();
|
||||
|
||||
pcre2_match_data **datas = alloc_match_datas(n_threads, code);
|
||||
|
Reference in New Issue
Block a user