]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
ap_regex: Use Thread Local Storage (if efficient) to avoid allocations.
authorYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 11:09:34 +0000 (11:09 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 11:09:34 +0000 (11:09 +0000)
commit747df57e08b23cf93c01b678de35b306e0e8bf6c
treec305e74e2177eaa82b71f8505b3db43edc5c1484
parente0889457b575ccb0b206b8620fe160d18760b649
ap_regex: Use Thread Local Storage (if efficient) to avoid allocations.

PCRE2 wants an opaque context by providing the API to allocate and free it, so
to minimize these calls we maintain one opaque context per thread (in Thread
Local Storage, TLS) grown as needed, and while at it we do the same for PCRE1
ints vectors. Note that this requires a fast TLS mechanism to be worth it,
which is the case of apr_thread_data_get/set() from/to apr_thread_current()
when APR_HAS_THREAD_LOCAL; otherwise we'll do the allocation and freeing for
each ap_regexec().

The small stack vector is used for PCRE1 && !APR_HAS_THREAD_LOCAL only now.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897240 13f79535-47bb-0310-9956-ffa450edef68
server/main.c
server/util_pcre.c