in reply to Re^2: Comparing pattern
in thread Comparing pattern
Did you read the documentation on study?
study attempts to make matches against a string more efficient, but incurs a one-time penalty for the time spent studying the string. It is most beneficial when you are doing many matches against a single string. You should benchmark to determine if you are getting any benefit from study. The first study in your code (line 10) is unnecessary, since you don't have a string in $_ to match against.
You keep saying "subroutine." Is this really in a sub? If so, are you reading in your patterns every time the sub is run? There's a major inefficiency. And once you solve that one, you can look at precompiling your expressions like I originally suggested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Comparing pattern
by mrc (Sexton) on Sep 21, 2009 at 17:54 UTC |