|
In a message dated 9/12/2005 4:27:22 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
> On 9/12/05, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote: > > > [ i get a performance improvement from the /o switch ] > > I am surprised, as I had thought that /o only applied when there > was a variable within the regexp. I guess I was wrong on that count. > > Have you tried C<study> on your switch variable? Does that help or > hurt? > > In response to your question, I would leave the /o switch in -- what could > the penalty be? > > > -- > David L Nicol david & deane --
i, too, was very surprised by deane's observation of a performance increase
with the use of /o in regexes that had no interpolated variables. i
was wondering if there might have been an interpolated variable in the elided
code, or if he was perhaps comparing different forms of ``switch'' construct,
e.g., the if ... elsif ... elsif ... else ... form with the for/do
flavor.
the other possibility that occurred to me was that the use of /o somehow
prompted the regex optimizer to recognize that the capturing parentheses were
never used and so effectively to eliminate them. i would expect some
sort of performance gain from this, although whether it would be measurable or
not is another question.
i would not expect study to be useful here. it is touted as
being useful when many different regexes are applied to a single, very long
string, which is not what deane has (at least not in the example
given). whenever i have experimented with study in the recommended
circumstances, i have seen no benefit -- although no detriment,
either.
btw -- the /o switch does not work at all whatsoever in activestate perl
version 5.6.x; it is a null operation. this was fixed in version
5.8.
bill walters
|
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
