Hello Rocky,

Wednesday, March 30, 2005, 7:34:05 PM, you wrote:

RO> Before i pull my hair out doing bench/resource test, i was wondering if
RO> anyone out there knew if there was much of a speed/resource usage
RO> difference between the following way of writing the same rule.

RO> Method A:
RO> body        rule_a          /(?:feh|meh|bleh)/i
RO> vs.
RO> Method B:
RO> bod         __rule_a        /(?:feh)/i
RO> body        __rule_b        /(?:meh)/i
RO> body        __rule_c        /(?:bleh)/i
RO> meta        rule_d          (__rule_a || __rule_b || __rule_c)

Well, the bod rule won't work very well...    :-)

RO> There probably isn't much difference using just 3 rules, but i'm thinking
RO> more along the lines of large(500+) lists and it isn't limited to just body
RO> stuff.  So if anyone has some realworld benching/experience with what is
RO> preferred or if the developers know which is faster for SA, i would love
RO> the input.

SARE's experience with BigEvil and EvilNumbers is that feh|meh|bleh
won't be much different between these, but if you end up with
dozens/hundreds of these, you'll definitely want to use combined
regex, along the lines of

body rule_ab /ab(?:ort|racadabra|raham)/
body rule_ac /ac(?:tion|cess|limate)/
body rule_x  /x(?:ylophone|avier)/

Pulling out the leading character(s) from long strings will have a
significant impact on the speed of the regex. The more you can do
that, the more you'll benefit.

But 500+ strings will be expensive no matter what you do.

Bob Menschel



Reply via email to