[Purdue-pm] Missed Presentation
Andy Lester
andy at petdance.com
Wed Apr 11 10:28:47 PDT 2007
On Apr 11, 2007, at 11:41 AM, Mark Senn wrote:
> o Right after some of these common cases were eliminated from $_
> a "study" command was done to (probably) make the rest of the
> ~2000 regexes run faster.
study is not helpful in the vast majority of cases. All it does is
make a table of where the first occurrence of each of 256 bytes is in
the string. This means that if you have a 1,000-character string,
and you search for lots of strings that begin with a constant
character, then the matcher can jump right to it. For example:
"This is a very long [... 900 characters skipped...] string that I
have here, ending at position 1000"
Now, if you are matching this against the regex /Icky/, the matcher
will try to find the first letter "I" that matches. That may take
scanning through the first 900+ characters until you get to it. But
what study does is build a table of the 256 possible bytes and where
they first appear, so that in this case, the scanner can jump right
to that position and start matching.
--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
More information about the Purdue-pm
mailing list