hi Gary,
that's an interesting question. Since PerlFunc patterns are compiled at SEC
startup and during pattern matching the compiled code is executed, there
are no noticeable performance differences between a regular expression and
PerlFunc containing the same regular expression. When you test pure parsing
speed in one-line perl script, you will probably find that split() works
faster. On the other hand, PerlFunc involves an extra function call which
is not the case for RegExp. I did a simple test myself for a log file
containing 100 thousand messages, and run sec with --notail option for this
file. I didn't see any significant differences, but in my test the patterns
only parsed out 4 fields, and the regular expression pattern was much
simpler.
Nevertheless, with PerlFunc you can nicely handle some specific cases of
events by doing some extra checks, which can't be done with regular
expressions. Also, in some cases PerlFunc is actually much more readable,
and when looking at two patterns from your mail, I was instantly able to
understand what is going on. If you intend the rule from your mail to be a
generic parsing rule where match results are cached and reused by many
other rules, you might find in some point of time that a single regular
expression is just not powerful enough to handle all possible event cases.
Recently, I thoroughly rewrote one of my oldest rulebases which contained a
lot of complex regular expressions for handling specific cases of the same
event class. The new rulebase has now just one Jump rule with an elaborate
PerlFunc pattern which does a lot of complex parsing with 30-40 lines. On
the other hand, other rules are now simply reusing match results from the
Jump rule,  instead of running a regular expression against input (similar
to the example from the new man page:
http://simple-evcorr.sourceforge.net/man.html#lbBA). As a result, the
overall CPU time consumption decreased by the factor of 2.5 for this SEC
instance. So sometimes PerlFunc patterns are really invaluable :)
kind regards,
risto



2013/6/1 Boyles, Gary P <[email protected]>

>  I was wondering if anyone has done an performance testing on regex (vs)
> perlfunc “patterns”?****
>
> ** **
>
> I was thinking of replacing this….****
>
> ** **
>
> *ptype=RegExp*
>
> *
> pattern=(\d+)\s+::\s+(\S+)\s+::\s+(\S+)\s+::\s+(\S+)\s+::\s+(\S+)\s+::\s+(.*)\s+::\s+(\S+.*)\s+::\s+(.*)\s+::\s+(.*)\s+::\s+(.*)
> *
>
> ** **
>
> With this….****
>
> ** **
>
> *ptype=perlfunc*
>
> *pattern=sub { my (@parseStr) = split/ :: /, $_[0]; if ($#parseStr > 4)
> {return (@parseStr); } else {return (0); } }*****
>
> ** **
>
> ** **
>
> And was wondering what performance differences there might be.****
>
> ** **
>
> My events have this format… (input format) of ---****
>
> ** **
>
> *$1  ::  $2  :: $3 ::   $4    ::   $5     ::  $6   ::   $7    ::  $8
> ::  $9  ::  $10*
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Simple-evcorr-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>
>
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to