From: MenTaLguY Date: 2007-04-13T02:53:02+09:00 Subject: Re: Slow ruby regexes On Fri, 13 Apr 2007 02:47:34 +0900, MenTaLguY wrote: >> In some instances it will take longer to compile the >> regex into a DFA then it will take to evaluate the simple NFA >> representation. > > Namely, when most of the states in the NFA will not be visited for a > particular input. That is why the DFA construction is done lazily. Sorry, I meant to say that it's when most of the states in the _DFA_ will not be visited for a particular input. Generally speaking, you can visit all the states in the NFA without necessarily visiting all the states in the DFA. -mental