Re: [pcre-dev] Posix API and JIT

Startseite
Nachricht löschen
Autor: Philip Hazel
Datum:  
To: Sheri
CC: pcre-dev
Betreff: Re: [pcre-dev] Posix API and JIT
On Wed, 16 Nov 2011, Sheri wrote:

> Here's a minimal request, please let me know if feasible.
>
> Suppose you added a regexec2 to the POSIX interface which passed study data
> instead of NULL to pcre_exec. Couldn't the native pcre_study be used to create
> study data based on the compiled pattern that was regcomp'ed? Mixed interface
> for our older "global" regex'es?


Performance would be poor because every time you called regexec2, it
would have to do the study and the free ... and JIT study takes
appreciative resources. So unless you only ever match a pattern exactly
once, the performance gain might (would?) not be much, if anything. We
already know that for relatively simple patterns matched once, JIT is
not worth using. It comes into its own when you can do *one* JIT study,
followed by *many* calls to pcre_exec.

OK, now you are going to say why not do the study outside regexec, based
on the POSIX data structure generated by regcomp (i.e. invent regstudy).
If you do that, you have to pass it to regexec2 somehow ... this is
changing your code quite a lot: adding a call to regstudy, modifying
the regexec calls. I would argue that this is almost as much work as
changing to the native API.

I appreciate your situation, not a nice place to be in.

Philip

--
Philip Hazel