develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #66762] Regex search time varies wildly with input

Thread Previous
James E Keenan via RT
February 24, 2013 22:36
[perl #66762] Regex search time varies wildly with input
Message ID:
On Mon Jun 22 00:42:32 2009, wrote:
> Citeren Andrew Daviel <>:
> >
> > -----------------------------------------------------------------
> > I often use Perl to analyze logfiles, using capture in regex to extract
> > timestamps. Recently I found a variation in computation time of
orders of
> > magnitude depending on the data being parsed and on apparently small
> > changes in the search pattern.
> If the time it takes for your re to match (or fail) depends on the  
> length of the string your are matching then you wrote a not so good  
> regex.
> See RT ticket 42721 (  
> ) for some  
> explanation. (Read the first reply (it is best to click the download  
> link else you won't see the identations))
> This is not the best explanation of course since it was written  
> especially for that bug report... It's still on my todo list to write  
> a better/more general explanation of this...
> Note that this will not explain the difference in your bug report but  
> it might help you with the original regex.
> Also note that your are not matching the same things in your bug report:
> > pattern time Perl v5.8.8
> > /.*[\d]+.*radon/ 2us 10us
> > /(.*[\d]+).*radon/i 130us 8ms
> > /(.*[\d]+).* (?i:radon)/ 12ms 8ms
> => The third wants to match a space before 'radon'; the first and the  
> second do not.  (meaning: you are not comparing m/.../i with  
> m/(?i:...)/)
> I would also suggest to use the Benchmark module to compare the  
> different versions and to post the resulst of that + the benchmarking  
> code you used
> Best regards,
> Bram

I reviewed this older ticket today.  My impression is that it's more of
a Perl usage question than a report of a bug in Perl.  The original
poster has not responded to Bram's comments made more than 3-1/2 years ago.

I recommend that the ticket be closed.  I will do so in seven days
unless someone wishes to take the ticket over.

Thank you very much.
Jim Keenan

via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About