The PHP manual states the following about the PCRE "S" modifier (Advanced template analysis) at http://php.net/manual/en/reference.pcre.pattern.modifiers.php
S
If the template will be used several times, it is worth spending more time analyzing it to speed up the time for matching. If this modifier is installed, then this additional analysis is complete. At present, the study of the sample is only useful for non-fixed patterns that do not have a single fixed start character.
Thus, its use is associated with patterns that must be used several times, without anchors (e.g. ^ , $ ) embedded in them or a fixed initial char sequence, for example. in a template of type '/^abc/' .
But there are no specific details about where, for example. apply this modifier and how it actually works.
Is it used only for the PHP stream of the current executable script, and after the script is executed, a "cached" analysis of the template is performed? Or does the engine store the analysis of the template in the global cache, which then becomes available for several PHP threads that use PCRE with the template marked with this modifier?
Also from PCRE introduction: http://php.net/manual/en/intro.pcre.php
Note. This extension supports global cache stream in compiled regular expressions stream (up to 4096)
If the "S" modifier is used only for threads, how does it differ from the PCRE cache of compiled regular expressions? I assume that additional information is stored, something like MySQL, when indexing rows in a table (of course, in the case of PCRE, this additional information is stored in memory).
And last but not least, someone experienced a real use case when he used this modifier, and you noticed an improvement and appreciated its benefits?
Thank you for attention.