In message <eddf5556138a864f836192f6d101812a1788e...@fmsmsx108.amr.corp.intel.c om>, "Boyles, Gary P" writes:
>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 Which is faster depends on how complex the regexp is. I have had some regexps that had to backtrack before they realized that they wouldn't apply to an event. The perlfunc parsing was faster to determine failure. In the case where the regexp was valid for the event I think it was close enough that I didn't care, but I chose the perlfunc because it failed more quickly. In your case I would expect the perlfunc to be faster but you really need to test it. I think you can test using: time sec -input test_data --notail -conf regexprule then a run with: time sec -input test_data --notail -conf perfuncrule where each conf has one single rule structured as a perlfunc or regexp. You need enough data in test_data that the work of compiling the perlfunc doesn't skew the timing, I would shoot for enough data to make at least one run take 5 minutes (but you coupld probably use a minute or so if you wanted). Run each test 5 or so times and see which comes out ahead. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. ------------------------------------------------------------------------------ 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 Simple-evcorr-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users