Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Parser Performance Questionby songmaster (Beadle) |
on Oct 05, 2017 at 09:02 UTC ( [id://1200717]=note: print w/replies, xml ) | Need Help?? |
Thanks for the replies so far. Taking out all the /o flags (which were supposed to speed up regexes back when we actually used Perl 5.6, yes this project is that old although not this code) helps a bit, now under Perl 5.24.1 the timing is: woz$ perlbrew use 5.18.0 woz$ time perl -CSD registerRecordDeviceDriver.pl softIoc.dbd real 0m0.417s user 0m0.377s sys 0m0.020s woz$ perlbrew use 5.24.1 woz$ time perl -CSD registerRecordDeviceDriver.pl softIoc.dbd real 0m7.549s user 0m7.215s sys 0m0.077s So that's another 2 seconds saved, but it still takes 7 seconds longer than it does under Perl 5.18.0. @Ken: I'm using our variables because they are actually set in another module. Given that the profiler doesn't show any significant amount of time spent in the (presumably related, but I don't know the internals) Parser::CORE:regcomp opcode I don't think pre-compiling the regexp's will make any difference. Looking through the individual regexp profiles again, I now see that there is one for detecting Perl POD which is taking up almost all of that 7 seconds:
Any ideas why this specific regexp is so slow in Perl >= 5.20? It's probably the only one that uses .* to match to the end of a line. I tried adding use re "debug"; and it's outputting lots of lines like this, which given the reference to an anchored substr "=" is probably the above match:
Further hints on understanding what those messages mean and how to clean this up would be most appreciated. - Andrew
In Section
Seekers of Perl Wisdom
|
|