pcre, bifs, drivers and ports

Mats Cronqvist mats.cronqvist@REDACTED
Thu Aug 3 15:48:26 CEST 2006


Bjorn Gustavsson wrote:

> So if you could be sure that a given regexp would be converted
> to a FA, your heuristic would work.

   i guess backreferences would have to be dropped.
   otoh, even if time IS exponential in the length of the string to be matched, 
limiting the length of the string would bound the time.

   btw, running the "killer regexp" on my 1.6 Mb test string only took 66 ms.
1> timer:tc(re,grep,[LLLStr,["^(?:(\\d+)|::)*$"]]).
{66120,[no_match]}

   not bad, only twice as expensive as length/1 :>

2> timer:tc(erlang,length,[LLLStr]).
{31789,1653696}

   does length/1 block the emu? and what about e.g. md5/1?

   mats



More information about the erlang-questions mailing list