Open paulbiss opened 9 years ago
Is it the right path to add a service request to compile the static string regex and write the handle in TC for the first time? The pcre caches for these regex can't be freed.
Well, it probably wouldn't be a service request, but the idea behind doing this with static strings is that they live forever anyway so it should be safe to burn the pcre handle in.
HH\Lib\Regex\Pattern<T>
literals are easy to spot in code.
re"/ab?cdc/"
In an ideal world, these would be compiled once and only once when this file is loaded (or even as a repo auth step, provided pcre handles can be serialized to disk). Hack can currently observe that re""
strings are just strings. A opaque value would be in order if changing this to a pcre handle expression.
When we statically know the regex string passed to PCRE we can avoid a cache lookup on each call by burning the handle for the compiled regex into the TC.