in reply to speeding up a regex

Instead of looping, you can compile everything into one simple regex, like so:
my $pattern = qr/\b(create|delete|insert|update|drop)\b/;

This gave me roughly a 3.5x performance increase over the loop method. It should be trivial to convert that to using an external file.

Replies are listed 'Best First'.
Re^2: speeding up a regex
by Fletch (Bishop) on Jan 03, 2006 at 18:34 UTC

    See also Regex::PreSuf for a slightly fancier option that might be even faster still if your different words share parts.